Pergunta

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 ?

Foi útil?

Solução

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

Outras dicas

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;

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.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a magento.stackexchange
scroll top