5

I'm using Magento 2 and I've noticed that on the related products block , on the product page , the add to cart button for the related products is actually a check box, and not a properly button.. is there any setting for that to be a properly button ?

  • Hi, i'm having the same issue. I was able to get the button added after changing $showCart = true. but how do i get rid of the checkbox? – Kris Wen May 21 at 0:54
  • @KrisWen Change $canItemsAddToCart = $block->canItemsAddToCart(); to $canItemsAddToCart = false; – MaddocksL Jun 17 at 14:54
  • @MaddocksL Thank you, i have resolved the issue. – Kris Wen Jun 17 at 21:16
10

By default Magento, there is no setting option in Admin for Add to Cart button on the related products block. If we want to custom the related, upsell, crosssel and new product template, we should override this template vendor/magento/module-catalog/view/frontend/templates/product/list/items.phtml.

Change $showCart = true; in case - related product.

We can refer here: Related Products template customize

| improve this answer | |
  • I was able to get the button added after changing $showCart = true. but how do i get rid of the checkbox? – Kris Wen May 21 at 0:55
2

For displaying the Add To Cart button, edit the below-mentioned file

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

$showCart = true;
| improve this answer | |
  • I was able to get the button added after changing $showCart = true. but how do i get rid of the checkbox? – Kris Wen May 21 at 0:55

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.