Show the metafield value of a product in the admin order page

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’ -%}


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!

1 Like

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

2 Likes

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

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


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
1 Like

This code only shows metafield on product page, not on order page in admin area

1 Like

Did you find the solution?

1 Like

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

I am seeking the exasct same thing. How to dosplay the value of a metafield in the admin order. Is there a solution yet?