Solved

Is there a way to update the Google Metafields via Shopify API?

trosman
Visitor
2 0 0

Hi!

We are using Shopify API to add and manage products in our store. However, we have a hard time finding out whether it is possible to set the Google Metafields via API (fields such as condition, size, color and google product category).

Would love the answer, since updating our 2000+ products would be a hassle to change manually. Thanks in advance! 🙂

/T

Accepted Solution (1)

Fenicia
Shopify Partner
1 1 1

This is an accepted solution.

Hi it seem like no one answered your question. 

Today we have the very same problem. Here is my solution.

As we already using API for our very own integration we don't want to use any third party app as many answers on this forum recomends to massive google metafiled setting. 


Instead we going to use metafields API 

So the very firs thing you will need to do is to install google shopping sales channeld and 

  1. Manually set the google fields for one product in the shopify dashboard.
  2. Copy the modified product id 
  3. On an REST API runner software such as postman make a request to products api 
    GET  https://yourstorename.myshopify.com/admin/api/products/{product_id}/metafields.json

  4. That query will return the product metafields. Because google channel uses metafields for storing its values, you will be able to see wich metafields are used by google
  5. Those fields are under the name space "mm-google-shopping" and values such as gender are stored under the value "gender" and age_group for the age group on google shopping. This is a huge advantage because you can see all the values that you need to use.
  6. On a separate request now you will be able to save your google shopping values via API without any third party app by calling

    POST 

    https://yourstorename.myshopify.com/admin/api/products/{product_id}/metafields.json


    Thats all you need use your metfields endpoint from admin api to create google shopping metafields.. if you dont know witch names, values use because it is poorly documented you can allways edit a product manually and then make a GET query to that product in order to see wich fields were created


Commerce Evolved

View solution in original post

Replies 2 (2)

Fenicia
Shopify Partner
1 1 1

This is an accepted solution.

Hi it seem like no one answered your question. 

Today we have the very same problem. Here is my solution.

As we already using API for our very own integration we don't want to use any third party app as many answers on this forum recomends to massive google metafiled setting. 


Instead we going to use metafields API 

So the very firs thing you will need to do is to install google shopping sales channeld and 

  1. Manually set the google fields for one product in the shopify dashboard.
  2. Copy the modified product id 
  3. On an REST API runner software such as postman make a request to products api 
    GET  https://yourstorename.myshopify.com/admin/api/products/{product_id}/metafields.json

  4. That query will return the product metafields. Because google channel uses metafields for storing its values, you will be able to see wich metafields are used by google
  5. Those fields are under the name space "mm-google-shopping" and values such as gender are stored under the value "gender" and age_group for the age group on google shopping. This is a huge advantage because you can see all the values that you need to use.
  6. On a separate request now you will be able to save your google shopping values via API without any third party app by calling

    POST 

    https://yourstorename.myshopify.com/admin/api/products/{product_id}/metafields.json


    Thats all you need use your metfields endpoint from admin api to create google shopping metafields.. if you dont know witch names, values use because it is poorly documented you can allways edit a product manually and then make a GET query to that product in order to see wich fields were created


Commerce Evolved
trosman
Visitor
2 0 0

Thank you! That helped a lot, and your solution seem to work!