1

How to display add to block on related products similar to it is displaying on list page?

  • The concept of related product is whenever you add any product from product details page then if check any related product's checkbox then that related product will also be added to cart with the product you have added. Thats why there is not add to cart button. If you want to use add to cart and wishlist button on related products then use upsell instead of related. – Sukumar Gorai Jun 15 '18 at 14:36
0

I am assuming you want to show add to cart, add to wish-list just like as on list page for related product on product view page.

As you know for showing related, upsell product there is a common file located at

vendor\magento\module-catalog\view\frontend\templates\product\list\items.phtml 

Copy above file to your theme, if not exist.

You can see in this phtml there is switch case for related and upsell product with some option.

There is already Add to cart button is available in this phtml, but with following condition:

if ($showAddTo || $showCart):

That means you need to set true to both above variables. Search $showAddTo and $showCart for related case and you will need to change

$showCart = true;

from

$showCart = false;

Above code will enable add to cart.

Note: If you need to hide add to cart checkbox and its label, it can be easily hide using CSS

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.