Quantcast
Channel: Opinion: Shopify Community - Shopify APIs & SDKs
Viewing all articles
Browse latest Browse all 25503

Hammad Khalid commented on How can I add meta description and page title to the product using api?

$
0
0

Hi Narendra, 

You want send a POST request to products/1234/metafields (assuming your product ID is 1234). The body of this request should be a Metafield with the namespace = global, and the key as "title_tag" or "description_tag". 

Below is an example of adding the title and meta description using the ruby API:

product = ShopifyAPI::Product.first

title_metafield = ShopifyAPI::Metafield.new(:namespace => "global", :key => "title_tag", :value => "My awesome product title", :value_type => "string")
product.add_metafield(title_metafield)

desc_metafield = ShopifyAPI::Metafield.new(:namespace => "global", :key => "description_tag", :value => "Totally awesome description", :
value_type => "string")
product.add_metafield(desc_metafield)

Hope that helps,

~ Hammad 


Viewing all articles
Browse latest Browse all 25503

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>