Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
Hi,
i am new to shopify and i need to use a product metafield to be shown in the order admin page.
Our sku does not relate to our warehouse storage bin location.
So I want to store my bin location in a metafield per product.
If a customer orders a product I need to show the value of the metafield in the admin order page.
How can I solve this problem?
Hi @TheChosen ,
Please follow below steps
From Shopify dashboard, go to Online store > Themes > Edit code
In the search box, search for the file named main-product.liquid
Scroll to line no 431 of this file, and paste below code just after the {%- form 'product', product, id: product_form_id, class: 'form', novalidate: 'novalidate', data-type: 'add-to-cart-form' -%}
<input type="hidden" name="properties[warehouse location]" value="{{ product.metafields.custom.material }}" />
Change product.metafields.custom.material with your field name.
Then this field will available to order list.
Does this method still work in the latest Online Store 2.0? If not, I need help!
Hey @Joey1919 the response from Hari1_prasad has nothing to do with the post's question.
Modifying the theme will only change the store's front end experience, not the Admin pages. (e.g. https://admin.shopify.com/store/{your-store}/orders
I'm hunting for the same solution to modify the columns on the Admin/Orders page
Hi @Joey1919 ,
Yes, @davidducrest is right my code would not help if you want to add new column in Shopify admin order listing page.
But my code will add a field of warehouse at order details page.
As your my understanding you prime concern is understand from which warehouse you have to ship the product.
If you want to add column in order listing you have to code for adding warehouse location tag in every order. Which will be available in order listing as separate column.
Let me know if you need more detail.
And about working in online 2.0, yes my code will work in it.
Hope it helps...
Hi Hari1_prasad,
in the main-product.liquid page I could not find the line
{%- form 'product', product, id: product_form_id, class: 'form', novalidate: 'novalidate', data-type: 'add-to-cart-form' -%}
instead there is a form at line 114 that says
{%- form 'product', product, id: product_form_installment_id, class: 'installment caption-large' -%}
I added this as you have suggested
<input type="hidden" name="properties[warehouse location]" value="{{ product.metafields.custom.warehouse_location }}" />
The value is also coming when I check the "view source" but there is no value in the admin order page detail page. What am I doing wrong? Please help
Hi @as01
Assuming you have already created product level metafield.
Just want to be confirmed have to assigned metafield value in product??
About the code location can't say anything without checking your store URL.
Make sure you assign metafield value in product in Shopify admin.
Hi @gr_trading
Thanks a lot for your quick reply. To confirm your points
Yes, the product level meta field is created
And I have assigned a value for that meta field. I have attached a screenshot for your reference.
When I view source the page I can see this value appearing as well
<form method="post" action="/cart/add" id="product-form-installment-template--19101421207873__main" accept-charset="UTF-8" class="installment caption-large" enctype="multipart/form-data">
<input type="hidden" name="properties[warehouse location]" value="NY" />
<input type="hidden" name="form_type" value="product" />
<input type="hidden" name="id" value="45143583916353">
...
...
As you can see <input type="hidden" name="properties[warehouse location]" value="NY" /> is showing
Now for showing it to the admin order page do I need to make any changes? If yes, then could you please tell me where?
Thanks again
Did you find the solution?
This code only shows metafield on product page, not on order page in admin area
Seems you are putting the code at wrong place.
We can do this setting for you request you to connect over the WhatsApp.
Details are in post footer
By investing 30 minutes of your time, you can unlock the potential for increased sales,...
By Jacqui Sep 11, 2024We appreciate the diverse ways you participate in and engage with the Shopify Communi...
By JasonH Sep 9, 2024Thanks to everyone who participated in our AMA with 2H Media: Marketing Your Shopify St...
By Jacqui Sep 6, 2024