diff --git a/shopify/resources/product.py b/shopify/resources/product.py index 06bd29f0..e08c1086 100644 --- a/shopify/resources/product.py +++ b/shopify/resources/product.py @@ -36,9 +36,10 @@ def save(self): api_version = ShopifyResource.version if api_version and ( api_version.strip('-') >= start_api_version) and api_version != 'unstable': - for variant in self.variants: - if 'inventory_quantity' in variant.attributes: - del variant.attributes['inventory_quantity'] - if 'old_inventory_quantity' in variant.attributes: - del variant.attributes['old_inventory_quantity'] + if 'variants' in self.product.attributes: + for variant in self.variants: + if 'inventory_quantity' in variant.attributes: + del variant.attributes['inventory_quantity'] + if 'old_inventory_quantity' in variant.attributes: + del variant.attributes['old_inventory_quantity'] return super(ShopifyResource, self).save()