Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Re: DAWN Theme - Add custom fields in Cart page and Show results in Orders Admin panel

Solved

DAWN Theme - Add custom fields in Cart page and Show results in Orders Admin panel

ajnoguerra
Shopify Partner
4 1 1

Hello Everyone, 

 

I tried the solution given by another Developer in adding custom fields inside the cart page by generating them from here - https://ui-elements-generator.myshopify.com/pages/cart-attribute, and placing them inside the form tags of my Cart template. It works with Debut theme, however, when I tried testing it in Dawn, the form shows but the data never appeared inside my Orders (Admin Panel).

 

Is there an alternative solution for 2.0 themes, specifically Dawn? 

sample formsample formAfter checkout, when I checked ordersAfter checkout, when I checked orders

Accepted Solution (1)

ajnoguerra
Shopify Partner
4 1 1

This is an accepted solution.

Someone gave a solution in Stackoverflow, by adding attribute form="cart" to each of the input fields. By the doing so, the syntax will be like this:

 

<p class="cart-attribute__field">
      <label for="long-custom-text">Long Custom Text</label>
      <textarea 
        required 
        form="cart" 
        class="required"
        id="long-custom-text" 
        name="attributes[Long Custom Text]"
      >
        {{ cart.attributes["Long Custom Text"] }}
      </textarea>
</p>

 Works like magic!

View solution in original post

Replies 2 (2)

NileshTejani
Shopify Partner
203 12 43

yes it work on Dawn theme also but you need to make sure you add this code in site 

<form> </from> tag

- Did we solve your issue? Like & Mark As Solution to help the community

Should you need any direct help:
Get connected: Upwork | Help Center

ajnoguerra
Shopify Partner
4 1 1

This is an accepted solution.

Someone gave a solution in Stackoverflow, by adding attribute form="cart" to each of the input fields. By the doing so, the syntax will be like this:

 

<p class="cart-attribute__field">
      <label for="long-custom-text">Long Custom Text</label>
      <textarea 
        required 
        form="cart" 
        class="required"
        id="long-custom-text" 
        name="attributes[Long Custom Text]"
      >
        {{ cart.attributes["Long Custom Text"] }}
      </textarea>
</p>

 Works like magic!