Search code examples
javascriptjqueryajaxshopifyshopify-app

How to call /cart/update.js in debut theme of shopify


All shopify experts are knowing that default debut theme is not having the version of ajax api.

I am developing my own website where i need to use cart update ajax.

I have tried with below code but it is giving me the errors in console.

jQuery.post('/cart/update.js', {updates: {90231456621: 2}});

Screenshot:

enter image description here


Solution

  • Answer: (So that other people having similar problems can see that this issue is solved)

    The ID that you were passing was a product ID, but the ID that Shopify expects for all of it's add/change/update endpoints is the variant ID. Changing to a legal variant ID should solve the problem.

    Cheers!