Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save pauloharaujos/c6c99b3c7f158ba10b114a8808e200da to your computer and use it in GitHub Desktop.

Select an option

Save pauloharaujos/c6c99b3c7f158ba10b114a8808e200da to your computer and use it in GitHub Desktop.
M1 - Add product to cart using AJAX on PDP
if ($('product_addtocart_form')) {
var data = $('product_addtocart_form').serialize();
data += '&isAjax=1';
var urlAddToCart = $('product_addtocart_form').action;
new Ajax.Request(urlAddToCart,{
method: 'POST',
async: false,
parameters: data,
onSuccess: function (response) {
console.log("CALL PAYPAL EXPRESS");
callShortcutPopup();
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment