Cart Attributes work on development store but not live

xandervds
Shopify Partner
10 0 1

Hi,

I'm working on a Shopify store with the 'Dawn' theme in use. We wanted to get some extra data from our user like their Instagram handle, gender and age, to get a better idea of the customers buying the products. The store doesn't run on a Shopify Plus plan so we decided to work with custom cart attributes, which I added in through the main-cart-items.liquid file. The fields aren't required, only for customers who'd like to answer. I tried this on a development server and everything works as expected, the data in those fields is saved in the new Shopify order under the 'additional details' tab.

 

When I use the exact same code setup on the live Shopify store however, nothing gets saved. The form does actually show up on the cart page, the data just isn't saved with the order once you continue on to checkout. I saw some similar posts but no one seems to have found a solution yet.

I can't seem to find any reason as to why this doesn't / shouldn't work on the live store running the same theme and everything.

My custom cart fields added to the main-cart-items.liquid:

 

<div class="cart-attributes__wrapper">
        <p class="cart-attributes__title">We would love to get to know you a little better before you order.</p>
        <p class="cart-attribute__field cart-attribute__field--singular cart-attribute__field--first">
          <label for="instagram-handle">Instagram handle</label>
          <input form="cart" class="cart-attribute__field-input" id="instagram-handle" type="text" name="attributes[Instagram handle]" value="{{ cart.attributes["Instagram handle"] }}">
        </p>
        <p class="cart-attribute__field cart-attribute__field--singular">
          <label for="age">Age</label>
          <input form="cart" class="cart-attribute__field-input" id="age" type="number" name="attributes[Age]" value="{{ cart.attributes["Age"] }}">
        </p>
        <div class="cart-attribute__field cart-attribute__field--radio">
          <label>Gender</label>
          <div class="radiobuttons-wrapper">
            <label class="radio-wrapper">
              Male
              <input form="cart" type="radio" class="cart-attribute__radio-input" name="attributes[Gender]" value="M"{% if cart.attributes["Gender"] == "M" %} checked{% endif %}>
              <div class='radio__checkmark'></div>
            </label>
            <label class="radio-wrapper">
              Female
              <input form="cart" type="radio" class="cart-attribute__radio-input" name="attributes[Gender]" value="F"{% if cart.attributes["Gender"] == "F" %} checked{% endif %}>
              <div class='radio__checkmark'></div>
            </label>
            <label class="radio-wrapper">
              X 
              <input form="cart" type="radio" class="cart-attribute__radio-input" name="attributes[Gender]" value="X"{% if cart.attributes["Gender"] == "X" %} checked{% endif %}>
              <div class='radio__checkmark'></div>
            </label>
            <label class="radio-wrapper">
              I'd rather not say
              <input form="cart" type="radio" class="cart-attribute__radio-input" name="attributes[Gender]" value="I'd rather not say"{% if cart.attributes["Gender"] == "I'd rather not say" %} checked{% endif %}>
              <div class='radio__checkmark'></div>
            </label>
          </div>
        </div>
      </div>

 

 

Does anyone have any idea to fix this on the live site? It's quite difficult to keep testing new orders, seeing as the site is live and we can't take it offline so we're testing whenever we know there probably won't be any new orders coming in.

Replies 4 (4)

PageFly-Theodor
Globetrotter
503 68 75

Hi @xandervds ,
This is Theodore from PageFly - Shopify Page Builder App.

 

To resolve the issue of custom cart attributes not being saved in the live Shopify store despite working in the development environment, ensure both environments run the same Shopify version and review any theme customizations for inconsistencies. Use the browser's developer tools to check for JavaScript errors during form submission and consider any potential interference from additional apps installed on the live store. Double-check your Shopify Liquid code for errors and consider adding debugging information to track data flow. It's also wise to look into server-side restrictions that might affect data processing. Contacting Shopify Support for specialized assistance can be helpful. When testing on the live site, choose a low-traffic period to minimize customer impact and carefully examine the checkout process to ensure it's not resetting or ignoring cart attributes. Always have a backup or rollback plan when making changes to the live environment.

 

I’ll be so happy if my suggestion can help to solve your problem. If you have any further questions, please feel free to tell me.
Best regards,
Theodore | PageFly

Please let me know if it works by giving it a Like or marking it as a solution!


PageFly - #1 Page Builder for Shopify merchants.


All features are available from Free plan. Live Chat Support is available 24/7.

xandervds
Shopify Partner
10 0 1

Thank you, I'll try and figure out where things go wrong on the live site for sure.

Do you have any tips on how to keep track of the custom cart attributes throughout the process, so I can see where they get ignored or reset? 

 

I am running the same Shopify version and theme version, so there's no inconsistencies there. There are some more apps running on the live store for reviews, but they do not affect any part of the cart or checkout process as far as I have found.

 

Thanks!

ianliao
Visitor
1 0 0

Hi @xandervds , I am a shopify third-party app developer, and I also ran into similar issue that the functionality works for development store (or test store) but not the real store. The issue starts at around 12.15 so I am wondering we might get into the same issue. Could we discuss a bit about it? Thanks!

Metz
Shopify Partner
8 0 0

Did you ever find a solution for this? I'm having the same issue, but cannot find a solution.