Skip to content

Commit

Permalink
Merge 97b8862 into f38b1b6
Browse files Browse the repository at this point in the history
  • Loading branch information
NFSS10 committed Sep 10, 2021
2 parents f38b1b6 + 97b8862 commit 728fa1d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Expand Up @@ -9,7 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

*
* Endpoint for creating and listing order metafields

### Changed

Expand Down
20 changes: 20 additions & 0 deletions src/shopify/order.py
Expand Up @@ -92,3 +92,23 @@ def fulfill_order(self, id, location_id, **kwargs):
url,
data_j = dict(fulfillment = fulfillment)
)

def metafields_order(self, id, *args, **kwargs):
url = self.base_url + "admin/orders/%d/metafields.json" % id
contents = self.get(url, **kwargs)
return contents["metafields"]

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

0 comments on commit 728fa1d

Please sign in to comment.