Add SEO meta description via Python API.

asjem
New Member
2 0 0

Hello, I'm trying to do this via the Python API... It succeeds, but it does not look like the SEO description was actually added when I look at the Shopify Admin. Any ideas?

mf = {
    "namespace": "global",
    "key": "description_tag",
    "value": "The description...",
    "type": "single_line_text_field",
}
sp = shopify.Product.find(w.shopifyid)
mf = shopify.Metafield(mf)
sp.add_metafield(mf)
sp.save()

 

 

Reply 1 (1)
asjem
New Member
2 0 0

So I finally worked this out, specifying the owner information in the metafield fixed it!

 

mf = {
    "namespace": "global",
    "key": "description_tag",
    "value": "blah",
    "value_type": "string",
    "owner_resource" : "product",
    "owner_id": w.shopifyid
}