2

I want to add wishlist block of customer on My Dashboard after Account Information. How can I do this ?

2

You can do this via layout files:

create customer_account.xml if not exits at at

app/design/frontend/{VendorName}/{Theme}/Magento_WishList/layout

Then

Add code:

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceContainer name="content">
            <block class="Magento\Wishlist\Block\Customer\Wishlist" name="customer.wishlist" template="view.phtml" cacheable="false" >
                <block class="Magento\Wishlist\Block\Rss\Link" name="wishlist.rss.link" template="rss/wishlist.phtml"/>
                <block class="Magento\Wishlist\Block\Customer\Wishlist\Items" name="customer.wishlist.items" as="items" template="item/list.phtml" cacheable="false">
                    <block class="Magento\Wishlist\Block\Customer\Wishlist\Item\Column\Image" name="customer.wishlist.item.image" template="item/column/image.phtml" cacheable="false"/>
                    <block class="Magento\Wishlist\Block\Customer\Wishlist\Item\Column\Info" name="customer.wishlist.item.name" template="item/column/name.phtml" cacheable="false"/>
                    <block class="Magento\Wishlist\Block\Customer\Wishlist\Item\Column\Cart" name="customer.wishlist.item.price" template="item/column/price.phtml" cacheable="false">
                        <block class="Magento\Catalog\Pricing\Render" name="product.price.render.wishlist">
                            <arguments>
                                <argument name="price_render" xsi:type="string">product.price.render.default</argument>
                                <argument name="price_type_code" xsi:type="string">wishlist_configured_price</argument>
                                <argument name="price_label" xsi:type="boolean">false</argument>
                                <argument name="zone" xsi:type="string">item_list</argument>
                            </arguments>
                        </block>
                        <block class="Magento\Wishlist\Block\Customer\Wishlist\Item\Options" name="customer.wishlist.item.options" cacheable="false"/>
                    </block>
                    <block class="Magento\Wishlist\Block\Customer\Wishlist\Item\Column\Actions" name="customer.wishlist.item.inner" template="item/column/actions.phtml" cacheable="false">
                        <arguments>
                            <argument name="css_class" xsi:type="string">product-item-inner</argument>
                        </arguments>
                        <block class="Magento\Wishlist\Block\Customer\Wishlist\Item\Column\Comment" name="customer.wishlist.item.comment" template="item/column/comment.phtml" cacheable="false">
                            <arguments>
                                <argument name="title" translate="true" xsi:type="string">Product Details and Comment</argument>
                            </arguments>
                        </block>
                        <block class="Magento\Wishlist\Block\Customer\Wishlist\Item\Column\Cart" name="customer.wishlist.item.cart" template="item/column/cart.phtml" cacheable="false">
                            <arguments>
                                <argument name="title" translate="true" xsi:type="string">Add to Cart</argument>
                            </arguments>
                        </block>

                        <block class="Magento\Wishlist\Block\Customer\Wishlist\Item\Column\Actions" name="customer.wishlist.item.actions" template="item/column/actions.phtml" cacheable="false">
                            <arguments>
                                <argument name="css_class" xsi:type="string">product-item-actions</argument>
                            </arguments>
                            <block class="Magento\Wishlist\Block\Customer\Wishlist\Item\Column\Edit" name="customer.wishlist.item.edit" template="item/column/edit.phtml" before="-" cacheable="false"/>
                            <block class="Magento\Wishlist\Block\Customer\Wishlist\Item\Column\Remove" name="customer.wishlist.item.remove" template="item/column/remove.phtml" cacheable="false"/>
                        </block>
                    </block>
                </block>
                <container name="customer.wishlist.buttons" as="control_buttons" label="Wishlist Control Buttons">
                    <block class="Magento\Wishlist\Block\Customer\Wishlist\Button" name="customer.wishlist.button.update" template="button/update.phtml" cacheable="false"/>
                    <block class="Magento\Wishlist\Block\Customer\Wishlist\Button" name="customer.wishlist.button.share" template="button/share.phtml" cacheable="false"/>
                    <block class="Magento\Wishlist\Block\Customer\Wishlist\Button" name="customer.wishlist.button.toCart" template="button/tocart.phtml" cacheable="false"/>
                </container>
            </block>
        </referenceContainer>
    </body>
</page>

If customer_account.xml is exits at

app/design/frontend/{VendorName}/{Theme}/Magento_WishList/layout

Then add below code under body tab <body></body>

product.price.render.default wishlist_configured_price false item_list product-item-inner Product Details and Comment Add to Cart

                <block class="Magento\Wishlist\Block\Customer\Wishlist\Item\Column\Actions" name="customer.wishlist.item.actions" template="item/column/actions.phtml" cacheable="false">
                    <arguments>
                        <argument name="css_class" xsi:type="string">product-item-actions</argument>
                    </arguments>
                    <block class="Magento\Wishlist\Block\Customer\Wishlist\Item\Column\Edit" name="customer.wishlist.item.edit" template="item/column/edit.phtml" before="-" cacheable="false"/>
                    <block class="Magento\Wishlist\Block\Customer\Wishlist\Item\Column\Remove" name="customer.wishlist.item.remove" template="item/column/remove.phtml" cacheable="false"/>
                </block>
            </block>
        </block>
        <container name="customer.wishlist.buttons" as="control_buttons" label="Wishlist Control Buttons">
            <block class="Magento\Wishlist\Block\Customer\Wishlist\Button" name="customer.wishlist.button.update" template="button/update.phtml" cacheable="false"/>
            <block class="Magento\Wishlist\Block\Customer\Wishlist\Button" name="customer.wishlist.button.share" template="button/share.phtml" cacheable="false"/>
            <block class="Magento\Wishlist\Block\Customer\Wishlist\Button" name="customer.wishlist.button.toCart" template="button/tocart.phtml" cacheable="false"/>
        </container>
    </block>
</referenceContainer>
  • this works for me but i have a question . How my dashboard know to add this on my dashboard. because in the customer_account_index in customer_module there are only three blocks. orders, info and address. How this knows that wishlist should be added too. – tech_geek Oct 11 '17 at 8:32
  • i have also asked the same question here – tech_geek Oct 11 '17 at 8:34
  • little bit busy now, reply you when i will free – Amit Bera Oct 11 '17 at 9:00
  • sure i am waiting for our response. This would be help me in getting out lot of problems regarding magento. – tech_geek Oct 12 '17 at 7:51
  • waiting for your response. can you please guide me in this regard? – tech_geek Oct 13 '17 at 7:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.