Conversations about creating, managing, and using metafields to store and retrieve custom data for apps and themes.
Hi,
I've been trying to fetch the seo meta title tag and description from a product to use it with my app. In documentation under product it says there is an attribute metafields_global_title_tag and metafields_global_description_tag but it doesn't fetch anything. Any ideas?
Where did you see the format for those metafields shown as "metafields_global_title_tag". The correct reference should appear like so :
metafields.global.title_tag
If a product has not been given a custom SEO title or SEO descripton those metafields won't exist.
I saw it in the API reference under the product in the product properties table
I found the answer, now the seem to appear on the endpoint admin/products/{ product_id }/metafields.json
Ryan is right, thanks.
The doc is outdated https://help.shopify.com/api/reference/product
The keys `metafields_global_title_tag` and `metafields_global_description_tag` don't exist.
Did anybody solve this issue with no keys?
Try this:
{{ product.metafields.global.description_tag | default: product.description | strip_html | truncatewords: 150, '' }}
Truncation is optional and included if product description fallback is necessary.
anyone knows how to change this????
In product admin scroll down to the "Search engine listing" and click "Edit". There you can set meta title and description in your default language