How to use a product attribute from WooCommerce

Since version 2.5 it’s possible to add product attributes to your global snippets as well. Here is how this works:

Why would you need this?

Google wants to see product data like gtin8, gtin12, gtin13, gtin14, mpn or isbn (depending on the type of product you’re selling). To be exact, they will show you a warning like this in the Structured Data Test Tool:

The gtin8, gtin12, gtin13, gtin14, mpn, isbn field is recommended. Please provide a value if available.

In general these messages are not errors. They’re just warnings because it’s not necessary to add these properties to your global snippets. However they’re recommended as you can see on the Google Reference for products.

The problem is that WooCommerce does not collect any data for these fields. So you have to add them yourself. One possibility is to use custom product attributes for this. And here is how it works step by step:

How to add a custom product attribute

  1. First of all, open up a product in WooCommerce.
  2. Scroll down to the product data metabox.

Prepare the WooCommerce product

  1. Click “Attributes”.
  2. Click “Add”.
Click "Atributes" and the "Add" button in the product data metabox.
  1. Add a name
  2. Choose if the attribute should be visible on the product page
  3. Enter a value

Prepare your global snippet

Now open op your global Product snippet.

  1. Search for the property you want to add (in this case it’s the gtin8 property.
  2. After it has been added to the list of properties, choose “Product Attribute (WooCommerce)” from the dropdown.
  3. Enter the name you have entered in the previous step. In this case it`s gtin8. Note that this field is case-sensitive!
How to add a WooCommerce product attribute to a global snippet

Save your settings.