Skip to content

Commit

Permalink
skip over products with empty metafields on shopify sync
Browse files Browse the repository at this point in the history
  • Loading branch information
Moggach committed Jun 4, 2024
1 parent 53c5e7e commit 939dc6e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions app/models/wagtail.py
Original file line number Diff line number Diff line change
Expand Up @@ -740,6 +740,13 @@ def sync_from_shopify_product_id(cls, shopify_product_id):
product = shopify.Product.find(shopify_product_id)
metafields = product.metafields()
metafields = metafields_to_dict(metafields)

# TODO adjust this function so that we can get different metafields from merchandise as opposed to books

if not metafields:
print('metafields are empty, skipping product')
return None

if cls.objects.filter(shopify_product_id=shopify_product_id).exists():
return cls.update_instance_for_product(product, metafields)
else:
Expand Down

0 comments on commit 939dc6e

Please sign in to comment.