Skip to content

Commit

Permalink
Adds product metafield creation support
Browse files Browse the repository at this point in the history
  • Loading branch information
joamag committed Apr 5, 2020
1 parent 626efe9 commit 6fb0d1c
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/shopify/product.py
Expand Up @@ -71,3 +71,18 @@ def metafields_product(self, id, *args, **kwargs):
**kwargs
)
return contents["metafields"]

def create_metafield_product(self, id, key, value, type = "string", namespace = "global"):
url = self.base_url + "admin/products/%d/metafields.json" % id
contents = self.post(
url,
data_j = dict(
metafield = dict(
namespace = namespace,
key = key,
value = value,
value_type = type
)
)
)
return contents["metafield"]

0 comments on commit 6fb0d1c

Please sign in to comment.