7

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 ?

asked May 3, 2016 at 15:31
3
  • 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? Commented May 21, 2020 at 0:54
  • @KrisWen Change $canItemsAddToCart = $block->canItemsAddToCart(); to $canItemsAddToCart = false; Commented Jun 17, 2020 at 14:54
  • @MaddocksL Thank you, i have resolved the issue. Commented Jun 17, 2020 at 21:16

3 Answers 3

17

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

answered May 3, 2016 at 16:01
2
  • I was able to get the button added after changing $showCart = true. but how do i get rid of the checkbox? Commented May 21, 2020 at 0:55
  • @KrisWen "$canItemsAddToCart = false;" Commented Jan 7, 2021 at 11:48
3

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;
7ochem
7,61516 gold badges54 silver badges82 bronze badges
answered Oct 7, 2016 at 12:55
1
  • I was able to get the button added after changing $showCart = true. but how do i get rid of the checkbox? Commented May 21, 2020 at 0:55
0

To remove the checkboxes (hilariously terrible UX choice! Having 'add to cart' checkboxes but then no 'add to cart' button visible?! So the user has to scroll back up and click the main product add to cart button to add a related product? Oh Magento... VOMIT 😅)

Set this in items.phtml:

$canItemsAddToCart = false;

Clear caches etc.

answered Jan 7, 2021 at 11:46

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.