Join us for an upcoming Shopify Partner webinar on February 27, 2024. Discover the latest Checkout Extensibility features, and deep dive on improvements to Shopify Functions and Web Pixels. Register now for either the 10am EST or 2pm EST sessions.

How to create a metafield on shopify site using api

naveedmetlo
Shopify Partner
13 0 1

I want to create metafield for a customer on shopify site when he logged in, i have gone through all forums, docs of shopify but no success, i found this link (http://www.shopify.com/technology/3032322-new-feature-metafields) where it can be done through api but i don't know how can i use api on liquid theme following example given on above url

<code>

product = ShopifyAPI::Product.find(148362461) 

product.add_metafield(ShopifyAPI::Metafield.new({ :description => 'product detail', :namespace => 'product', :key => 'user', :value => 'subscribed', :value_type => 'string' }))

</code>

Please guide me on this, how can i able to create a metafield using api.... Thanks in advance

- Regards

Naveed Metlo
Sr. Full Stack Developer
---------------------------------------------
Skype : naveedmetlo
Mobile : +92 333 7564114
Website : https://zalando.intbiztech.com/
Replies 3 (3)

Maarten_van_Gro
Shopify Staff (Retired)
155 0 26

You can't access the API like that via liquid. The API is used to create apps that run on your own servers in your favourite programming language. Those apps can be either privately for just your shop or used by multiple shops in the App store.

To learn more visit the Shopify Help Center or the Community Blog.

naveedmetlo
Shopify Partner
13 0 1

Can you send me link for PHP Programming language so i can use that api and how can i integrate that in Shopify apps ?

- Regards

Naveed Metlo
Sr. Full Stack Developer
---------------------------------------------
Skype : naveedmetlo
Mobile : +92 333 7564114
Website : https://zalando.intbiztech.com/

Maarten_van_Gro
Shopify Staff (Retired)
155 0 26

You can learn more about the API here: http://docs.shopify.com/api and some PHP plugins that use the API can be found here: http://docs.shopify.com/api/libraries/php

To learn more visit the Shopify Help Center or the Community Blog.