Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
I'm trying to work out how I can transfer additional, non Customer defined, Product detail to an Order when a customer makes a purchase.
Background
I run a single product business which sells eggs locally. Customers sign up to receive a deliery of eggs either once, or on subscription every 1, 2 or 3 weeks.
Customers cannot choose when to receive their delivery. Instead a customer's postcode will determine the day of the week that they receive their delivery.
In the first step of the checkout flow, a customer enters their postcode. They are then redirected to the Product page relating to their deliery day (eg Eggs for Thursday delivery).
I have created a product for each day of the week (eg Eggs for Monday delivery, Eggs for Tuesday delivery etc).
Customers can only buy one product, and they only see the product which delivers to their area. When a new order is created, I need to somehow record the Delivery Day (eg Monday, Tuesday etc) as a discrete value in the order.
What I'm seeking to understand is whether I can achieve this with Metafields, or whether I need to look at alternatives such as Cart Attributes or Line Items.
Thank you.
Solved! Go to the solution
This is an accepted solution.
Ok, this is now resolved. @Made4uo-Ribe your very helpful contribution above got me most of the way there. I also used this very helpful video.
The fix (including incorporating the metafield) was to insert the following into the relevant Product Page using a piece of Custom Liquid code:
<input type="hidden" name="properties[Delivery day]" value="{{ product.metafields.custom.delivery_day.value }}">
Hi @booter9898
I assume that every product page is different for each delivery day? If so, you can pass a product line item in the order. You can read more information here. You can then assign the value base on the product delivery day. You can have this hidden in the customer view, but available at the admin order page.
Yes, that is correct. Each day of the week has its own product page.
Thank you for that suggestion. It sounds as if it might do what I need it to. Are you able to offer any suggestions as to:
1) how to prefill/assign the value for that field; and
2) hide that field from customer view?
Thanks again.
Hi @booter9898
You can paste the following code to the corresponding products inside the product form. Placement depends on what theme you are using.
NOTE: You can see the value differs
For Monday product:
<input type="text" name="properties[_Delivery day]" value="Monday">
For Tuesday product:
<input type="text" name="properties[_Delivery day]" value="Tuesday">
Please don't forget to Like and Mark Solution to the post that helped you. Thanks!
Amazing. Thank you so much.
I have created a Product metafield (product.metafield.custom.delivery_day) and added the Delivery Day for each Product.
If I were to insert the code you provided into the Product page template, rather than 'hard coding' the delivery day for each product, is it possible to populate the line item field with the value of the product.metafield.custom.delivery_day metafield?
This is an accepted solution.
Ok, this is now resolved. @Made4uo-Ribe your very helpful contribution above got me most of the way there. I also used this very helpful video.
The fix (including incorporating the metafield) was to insert the following into the relevant Product Page using a piece of Custom Liquid code:
<input type="hidden" name="properties[Delivery day]" value="{{ product.metafields.custom.delivery_day.value }}">
Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025Unlock the potential of marketing on your business growth with Shopify Academy's late...
By Shopify Mar 12, 2025Learn how to increase conversion rates in every stage of the customer journey by enroll...
By Shopify Mar 5, 2025