So I've found the location to turn on ajax add to cart in the product page. I've also found where the;

$showCart: true

Lives to enable the related products to have an add to cart button on them.

My question is, is there a way i can add an ajax add to cart for the related products? I've not seen it anywhere in the code. And I've looked. I thought by adding the ajax request to the product page may work, but looks like it is working off of the form id.

Now I know that the button for the related doesn't submit a form, it submits itself. So is there actually a way to ajax this?

$postDataHelper->getPostData($block->getAddToCartUrl($_item), ['product' => $_item->getEntityId()])

This is what i posts, but does Magento have ajax built in for this, or do i need to create a custom module?


Your Answer

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

Browse other questions tagged or ask your own question.