简体   繁体   English

如何在shopify的首次亮相主题中调用/cart/update.js

[英]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. 所有shopify专家都知道默认的首次亮相主题没有ajax api的版本。

I am developing my own website where i need to use cart update ajax. 我正在开发自己的网站,在这里我需要使用购物车更新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: 屏幕截图:

在此处输入图片说明

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. 您传递的ID是产品 ID,但Shopify期望其所有添加/更改/更新端点的ID是变体 ID。 Changing to a legal variant ID should solve the problem. 更改为合法的变体ID应该可以解决该问题。

Cheers! 干杯!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM