Warenkorb-Button in Wishlist Shopware 5

Even without a plugin, it is relatively straightforward to add an add-to-cart button to the wishlist in an online shop implemented with Shopware 5. Based on the buy button used in the product listing (/themes/Frontend/Bare/frontend/listing/product-box/button-buy.tpl), we need to find the appropriate template file for displaying the items in the wishlist. We find this in /themes/Frontend/Bare/frontend/note/item.tpl. More specifically, the relevant block here is {block name="frontend_note_item_actions_buy"}. Of course, you should not modify the Bare theme directly, but instead extend the block in your own theme. We then populate the block with the shopping cart form, as it is also displayed in the product listing:

 

 {* +Place article in basket *}      

{block name="frontend_note_item_actions_buy"}                        

{block name="frontend_note_item_actions_buy"}                        

                               <form name="sAddToBasket"

                                                                 method="post"

                                                                 action="{$url}"

                                                                 class="buybox--form"

                                                                 data-add-article="true"

                                                                 data-eventName="submit"

                                                                 {if $theme.offcanvasCart}

                                                                 data-showModal="false"

                                                                 data-addArticleUrl="{url controller=checkout action=ajaxAddArticleCart}"

                                                                 {/if}>

                                               {block name="frontend_note_item_actions_buy_order_number"}

                                                               <input type="hidden" name="sAdd" value="{$sBasketItem.ordernumber}"/>

                                               {/block}

                                               {block name="frontend_note_item_actions_buy_button"}

                                                               <button class="buybox--button block btn is--primary is--icon-right is--center is--large">

                                                                               {block name="frontend_listing_product_box_button_buy_button_text"}

                                                                                              {s name='NoteLinkBuy'}{/s}<i class="icon--basket"></i> <i class="icon--arrow-right"></i>

                                                                               {/block}

                                                               </button>

                                               {/block}

                               </form>                                                                                                            

{/block}               

{* -Place article in basket *}

 

This makes it possible to add an item saved in the wishlist directly to the shopping cart. Tested at our web agency in an online shop built with Shopware 5.5.6 (Professional Edition).