Adding Item to Cart Through Ajax Call on Cart Page (cart/add.js) Ajax API



My theme using Ajax API to add items to the cart.

I’ve created a copy of product-template.liquid with a text field for customisable products.

Everything is working fine on original product-template page , but on copy template, When I click on Add to cart it gives the following error

{"id":43432910725,"properties":null,"quantity":1,"variant_id":43432910725,"key":"43432910725:28155ef254b327ac4db38abc170ca632","title":"Embroidered Canvas Shopper Bag with initials","price":0,"original_price":0,"discounted_price":0,"line_price":0,"original_line_price":0,"total_discount":0,"discounts":[],"sku":"","grams":0,"vendor":"Initial Me","product_id":9078712773,"gift_card":false,"url":"\/products\/initialled-jute-bag?variant=43432910725","image":null,"handle":"initialled-jute-bag","requires_shipping":true,"product_type":"","product_title":"Embroidered Canvas Shopper Bag with initials","product_description":"Personalise yours or your friends \u0026amp; families shopping trips with our sleek yet understated embroidered shopping bag. We embellish your bag with a Classic font in order to create a timeless product. We also give you the opportunity to chose from a variety of thread colours for the applied initials to match any mood.\nWe have created this must-have not only for your fruit \u0026amp; veg but also for any general use you have for it including for School, The Beach or even to carry around your babies nappies. The bag itself is extremely strong \u0026amp; durable plus its even made from 100% Fair Trade Cotton Canvas. \nSo go ahead, save the planet \u0026amp; never spend 5p on another plastic shopping bag again. Please remember to apply your Custom Initials \u0026amp; Embroidery options above.\n ","variant_title":null,"variant_options":["Default Title"]}

Here is my code for custom product field

<p class="line-item-property__field">
                  <label for="Customisation" style="font-size: 17px; font-weight: 700; font-family: 'Patrick Hand SC',cursive;">Customisation </label>
  <input id="Customisation" type="text" name="properties[Customisation ]"  maxlength="4" placeholder="Maximum 4 Characters" size="25">
  <p class="line-item-property__field">
    <label for="plain" style="font-size: 17px; font-weight: 700; font-family: 'Patrick Hand SC',cursive;">Plain</label>
  <input type="hidden" name="properties[Plain]" value="No">
  <input id="plain" type="checkbox" name="properties[Plain]" value="Yes">


I’ve also tested my copy product template without the Code above but the above error is persistent. Anyone with solution please help me get to the root of the problem. Thanks in advance.


Hey there, thanks for your post.

This is the forum for the GitHub GraphQL API and the GitHub Apps feature.

It doesn’t sound like that’s what you’re asking about.

It’s hard to tell from your comment, but it looks like you’re trying to get help with a project that is hosted on GitHub. Since we don’t maintain that project, we are unable to help you with it. If you can find the project’s repository, then you should be able to get help either by opening an issue in the repository, or by checking their README to find out if they have a chat room or mailing list.