All things Shopify and commerce
I've added the following two fields to a snippet that is being called from the product-template.liquid file:
<p>
Start Date:<br>
<input class="datepicker" id="from" name="attributes[Rental Start Date]" type="text" value="{{ cart.attributes["Rental Start Date"] }}">
</p>
<p>
End Date:<br>
<input class="datepicker" id="to" name="attributes[Rental End Date]" type="text" value="{{ cart.attributes["Rental End Date"] }}">
</p>
These are required fields and necessary for us to check inventory and process the order after it has come through. Everything has always worked up until about 3-4 days ago when the data stopped coming through and now doesn't show up in the Additional Details section of the admin shopify order view.
Just curious if anyone else has experienced this recently or if there is something obvious about the way I've implemented the attribute property into the input field that is causing this?
Solved! Go to the solution
This is an accepted solution.
Hi @joe-adelie I looked at the site and the code on the product pages will not work. The simplest solution would be remove the rental date fields from the product page and add them to the cart. If you wanted to set the value from the product page you would need a developer to create a custom solution.
The cart page attribute example that you shared is kinda working but it not setup correctly. I would recommend using this tool from Shopify to create your cart attribute fields. The element you appear to be missing is the Liquid tag to display the saved "Customer Notes" value. That tag is added correctly if you use the tool linked above.
In the attached, you can see that the test value I entered has been saved but after clicking the "Update Cart" button it stops displaying because the Liquid tag I mentioned above is missing.
You can also verify the cart attributes are saving correctly by viewing the cart.json file by simply appending .json to the end of the cart URL. See attached image.
You're also going to need to update or remove the script you have running on the checkout button. Simplest solution would be to make the cart attributes required and enable form validation (here's an example).
This seems to be an issue on Shopifys end. Many apps relying on tagging and attributes have completely broken. Hopefully, there is a fix in the coming days.
Do you know which apps specifically? Or is this just affecting all shopify users across the board?
I'm having a similar problem. Are you using any apps for your site's checkout?
Yeah still an issue for me. 5 orders today and none of them have the attribute data. 1 of 2 orders on Saturday had the attribute data. Seems to be completely random. Am using an app at checkout that handles shipping calculation but that's it. All the orders that have come in today are store pickup orders though and not calculated deliveries. Really hope they can figure this out soon.
Hey @joe-adelie we also have the issue! We have a ticket open with Shopify Partner support, ticket number 39167890. We have not had an update in over 5 days, we had a placeholder response yesterday but no real resolution to the issue! Are you still seeing the issue occur on your stores?
Hey @samZapiet yeah still not coming through even today. Super frustrating. Would you please let me know if/when you hear anything from your support ticket? Wondering if it has something to do with the pickup and delivery piece of our applications as our code hits that piece of Shopify's api as well?
Hey @joe-adelie ,
Unfortunately we have not had any meaningful updates. In our tests we actually used stores without our applications or code installed and were able to replicate the bug! But the only response that we have gained from Partner Support so far was completely unrelated and non-useful. As a final step to try and accelerate the resolution process here, we are now directing all of our Merchants with the issue to contact Shopify support, quoting our ticket number 39167890. Does your team have a separate ticket number open? Maybe if we're to join forces, we can add some pressure to get a resolution a little faster!
This example code is not valid because you have quotes inside of quotes. Is this the actual code in use? Can you update your code as shown below and test?
original:
value="{{ cart.attributes["Rental End Date"] }}"
Updated:
value="{{ cart.attributes['Rental End Date'] }}"
Thanks for the response Jesse. While this is true, it is not the solution to this problem unfortunately. This value property was added after the order details stopped coming through in hopes of fixing the problem. Even after changing to single quotes within the property value the details are still not coming through on new orders. This has to be something that has changed on Shopify's end.
Ah, you're right. Since the quotes are inside of a Liquid statement they don't break the syntax. My bad, I was viewing on a phone and didn't notice that. I'm on my computer now and better able to read the original question. It looks like you are trying to use cart attributes from the product page but they only work when they are inside of a cart form. To capture data like this on a product form you'd need to use line item properties. Can you share the site so I can take a look?
Ah good call. I read that somewhere as well but wasn't sure about it since it was working before and just suddenly stopped working. The problem with line item properties is that I want this particular data to apply to the whole order and not just the individual items... however, the most logical spot to put the inputs is on the product pages because we need the dates in order to check inventory before they try to add the product to their cart. The code I pasted in the question is inside the product form but I have another instance of an input with this same format that is inside the cart form on the cart page that also isn't passing in data. The liquid for that is
<form id="cart-form">
<!-- your cart page -->
<div>
<label for="new-attribute" >Any Special Requests?</label>
<textarea rows="5" type="text" name="attributes[Customer Notes]" id="new-attribute"></textarea>
</div>
<!-- more of your cart page -->
</form>
The website is https://www.perfectpartyplace.ca/
Appreciate the help!
This is an accepted solution.
Hi @joe-adelie I looked at the site and the code on the product pages will not work. The simplest solution would be remove the rental date fields from the product page and add them to the cart. If you wanted to set the value from the product page you would need a developer to create a custom solution.
The cart page attribute example that you shared is kinda working but it not setup correctly. I would recommend using this tool from Shopify to create your cart attribute fields. The element you appear to be missing is the Liquid tag to display the saved "Customer Notes" value. That tag is added correctly if you use the tool linked above.
In the attached, you can see that the test value I entered has been saved but after clicking the "Update Cart" button it stops displaying because the Liquid tag I mentioned above is missing.
You can also verify the cart attributes are saving correctly by viewing the cart.json file by simply appending .json to the end of the cart URL. See attached image.
You're also going to need to update or remove the script you have running on the checkout button. Simplest solution would be to make the cart attributes required and enable form validation (here's an example).
@Jesse_Meyers This was the answer! We were already saving the values on the product page to local storage so just needed to add the inputs to the cart page as hidden fields and populate them with the saved dates. The .json trick is super helpful as well! Appreciate the help. Order has already come through and contains the needed info.
Hi, for all of those who still facing some really really weird issues with the attributes.
A great workaround solution I found is the following -
1) Remove the name="attributes[someId]" field, not needed at all.
2) Add an onchange=addAttribute(this.value, 'attributeId'); on each <input> or <textarea>
3) Inside the addAttribute -
function addAttribute(value, attributeName) {
jQuery.post('/cart/update.js', `attributes[${attributeName}]=${value}`)
}
So everytime there's a change in the input / textarea you'll invoke this function that adds / updates the that specific attribute's value.
Hope it helps anyone who came across this one.
Great Advice!
Obviously, standard HTML rules apply. You still require the name attribute (name="whatever") on specific inputs like radio types to ensure only one selection is chosen. Only name attribute isn't relied on for attribute form-data.
Thank you @dorforman23 - I'd say this is the best answer available.
This worked! Been stuck on this problem for a whole day. Thanks!! XD
I want to attempt this workaround but I'm really new to this stuff and don't know exactly where each section goes. I notice you are using JS but I don't know exactly where to put everything. Would you be able to show this in action on an example?
As 2024 wraps up, the dropshipping landscape is already shifting towards 2025's trends....
By JasonH Nov 27, 2024Hey Community! It’s time to share some appreciation and celebrate what we have accomplis...
By JasonH Nov 14, 2024In today’s interview, we sat down with @BSS-Commerce to discuss practical strategies f...
By JasonH Nov 13, 2024