Solved

Add a notes for each item in cart

yohanes-ai
Shopify Partner
7 2 0

Hi there

 

I create a Shopify app with extension theme app that has capability to customize each item that adding to cart or directly buying. I wanted to sell a hat that everyone can customize text on the hat. So I create an app that has a input text to directly input a text or translate a text if needed (with options of course). 

 

So the extension theme app is done, the problem is how to add a notes for every item in the cart. I have tried cart notes but its build for adding notes for a whole cart not every item (like in one order). Any idea?

 

Thanks in advance

Accepted Solution (1)

yohanes-ai
Shopify Partner
7 2 0

This is an accepted solution.

I have found the solution by adding this simple code as below:

name="properties[Text]" form="product-form-{{ section.id }}

 

The full example as below:

<label for="message" class="form__label">Message:</label>
<div class="field">
  <textarea id="message" class="text-area field__input" placeholder="Message" name="properties[Message]"form="product-form-{{ section.id }}"></textarea>
</div>

 

I have tried and its working like a charm.

 

View solution in original post

Replies 4 (4)

ChrisBao
Shopify Partner
6 0 1

So you mean the user may add more than one hat into the cart. And you want the functionality to customize the text printed on each hat. Right? 

yohanes-ai
Shopify Partner
7 2 0

Yes, you're correct. Its likely add a notes for each item. So it there is 3 items in cart. Every item has a note

YOD_Solutions
Shopify Partner
196 22 29

Note is not a line item property - it a cart property. You have one note field for the whole cart. You need to add your custom items in the line item "properties" field (or customAttributes field in GraphQL) - which is an object with "key" and "value" fields.

Founder @ JsRates: Custom Shipping Rates
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more about JsRates visit the JsRates home page or JsRates documentation
- Find JsRates on Shopify app store

yohanes-ai
Shopify Partner
7 2 0

This is an accepted solution.

I have found the solution by adding this simple code as below:

name="properties[Text]" form="product-form-{{ section.id }}

 

The full example as below:

<label for="message" class="form__label">Message:</label>
<div class="field">
  <textarea id="message" class="text-area field__input" placeholder="Message" name="properties[Message]"form="product-form-{{ section.id }}"></textarea>
</div>

 

I have tried and its working like a charm.