Most retailers use a GTIN (Global Trade Item Number) to track and identify their products, but WooCommerce does not have this field by default.
In this post I’ll show you how to add it.
What is a GTIN?
A GTIN is a unique, internationally recognized product tracking number.
In North America, a UPC code is used, while in Europe it’s called an EAN. You may also have heard of an ISBN, which is used for books.
GTINs are used for internal tracking, and are required in product feeds for Google and Amazon.
How to add a UPC/EAN/ISBN field to WooCommerce
By default, WooCommerce comes with a field for SKU, but not GTIN. To add the GTIN field for your UPC, EAN, or ISBN number, we can either use a plugin or custom code.
Here are some things to consider about your GTIN:
- GTIN field is optional, and can be shown or hidden on product pages.
- Variable products must allow for separate GTINs for each variation
- GTIN can be used for Google and Amazon product feeds
Doing this with custom code is a bit complicated, so I built a plugin to do this all for you.
It’s called WooCommerce Add GTIN and you can get it by going to plugins => add new, or download it directly.
This plugin adds a GTIN field to each product under Inventory. It also adds a unique GTIN field for each product variation.
The GTIN is displayed on the product page with the other product meta. To hide the GTIN on the product page, visit WooCommerce settings => Products => Inventory => “Hide GTIN on single product pages.”
Add GTIN to your Google Products Feed
To create a Google Shopping feed, you can use a plugin like Product Feed Pro.
Create a new feed, choose your feed type, and map the HWP GTIN field to your feed mpn or gtin field.
If you have any questions leave them in the comments.
25 thoughts on “How to Add a GTIN (UPC, EAN) field to WooCommerce”
THanks for the plugin, it works great.
What is the name of the variable to get the GTIN for each item ?
This is for google merchandising for instance.
Hi, the main GTIN is in post meta under hwp_product_gtin:
get_post_meta( $post_id, 'hwp_product_gtin', 1 );
If you have variations with GTINs, you can find those in post meta like this:
get_post_meta( $variation['variation_id'], 'hwp_var_gtin', 1 );
You have to loop through the variations to get that.
Will this field be searchable in woocommerce backend ? I mean in example on the orders list page or products list page or either when adding a product to a new order (backend) this would be great to use the backend as a casher with a barcode reader.
Hi, this plugin uses post meta, I don’t know if that’s searchable. You may have to use a plugin that incorporates post meta into search, but it should be possible.
This looks like a great plugin! Thank you for making it available!
A question please, if I may?
I’m trying to setup a Google shopping feed and Google is requiring Brand and GTIN. I am using a plugin that I downloaded to build this feed. It’s allowing me to map my fields to the required shopping feed by having me choose from a drop down list. Will the GTIN from your plugin show in the dropdown list?
Hi Mark, the plugin uses the following post meta keys:
hwp_product_gtin, and hwp_var_gtin.
I’m not sure how your feed plugin works, but you would have to map it to those values as needed.
Scott thank you so much, this is the perfect plugin, does exactly what it promises. This is saving me such a headache right now, I am so grateful!
Thanks for the great plugin. We are currently trying to access the GTIN field through WooCommerce REST API, but can’t find the field anywhere?
Any clues where to look?
I think you’d have to add it to the rest api, post meta does not show up by default. You can probably use https://developer.wordpress.org/reference/functions/register_rest_field/
I have added the plugin.
the field is shown as described
but it is empty.
do I need to enter a Gtin to each product?
Thanks for this great plug in, its added exactly what i needed to my woocommerce store. Only problem i have is that we have installed a POS plug in for the shop as a physical shop is opening in a few weeks. The plug in im using is woocommerce POS by actualityextensions. The plug in allows you to use a scanner to scan EAN products, only problem is in the POS plug in you need to select which fields to search when scanned. Iv looked for hwp_product_gtin, and hwp_var_gtin, but neither show up in the list of searchable fields. Any way i can make the EANs searchable.
Can I move the field under SKU field on product variations ?
can I change GTIN field to become a Brand field? 🙂
Maybe by modifying your plugin?
Great plugin and it worked perfectly on my single store, but when i try it in multistore the “field” wont show. You experienced any thing like it?
Best Regards Lasse
As you can see from the first screen shot below I installed “WooCommerce UPC, EAN, and ISBN” at https://pigglywigglyorder.com but the second screen shot shows that the option is not available under the Inventory Tab. Please advise.
I’m using the ‘WooCommerce Customer/Order CSV Export’ plugin, which allows me to assing and add a meta field to my exported CSV reports.
I’ve assumed the field I need to add to my export report is ‘hwp_product_gtin’, so I’ve added this field, however nothing is showing up in my exported report.
Is anyone able to share any code – or guidance – to assist me in achieving this (I’m assuming something needs to be set up in funtions.php to register the field) ?
I’m out of my depth with this sort of thing so I’d be most grateful for any assistance.
Can you tell us the steps for imports products with CSV with the GTIN, I can’t do it with the information of hwp_product_gtin.
i recently install the plugin but i need to export this field in the csv file.
i’m tryind to do it with products->export, but the generated file does not contain the gtin field.
how can i do it?
I also have the same issue, how could we add/edit GTIN field in bulk from flat file. We have 5k+ products and its hectic to add/edit 1 by 1. Please help.
Hi Scott, are there any plans to update this plugin?
Or can I build my own fork of it (I think it is open source?)
I just released an update. You are free to use the code according to the GPL license.
I filled gtin in all of my products but google console says it require gtin ?
how to fix this
Hi, you can add it to your Google feed using a feed plugin.
I would like to show GTIN as a field also in orders. Is it visible there or it needs to add more source code for this ?
I have added the plugin , able to add gtin but in google webmaster , still validation is failing . it looks gtin is not getting added in schema
Please suggest solution