From d393438c02d59b8092a3d06306bba0c8629c6238 Mon Sep 17 00:00:00 2001 From: Sukhman Date: Mon, 9 Feb 2026 10:14:18 +0530 Subject: [PATCH] fix: handled attributes table --- woocommerce_fusion/tasks/sync_items.py | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/woocommerce_fusion/tasks/sync_items.py b/woocommerce_fusion/tasks/sync_items.py index 0448b72..e9ec492 100644 --- a/woocommerce_fusion/tasks/sync_items.py +++ b/woocommerce_fusion/tasks/sync_items.py @@ -393,12 +393,23 @@ def create_item(self, wc_product: WooCommerceProduct) -> None: # Handle variants' attributes if wc_product.type in ["variable", "variation"]: self.create_or_update_item_attributes(wc_product) - wc_attributes = json.loads(wc_product.attributes) - for wc_attribute in wc_attributes: - row = item.append("attributes") - row.attribute = wc_attribute["name"] - if wc_product.type == "variation": - row.attribute_value = wc_attribute["option"] + # wc_attributes = json.loads(wc_product.attributes) + wc_attributes = json.loads(wc_product.attributes) if wc_product.attributes else [] + + if not wc_attributes and wc_product.type == "variation": + pass + + # for wc_attribute in wc_attributes: + # row = item.append("attributes") + # row.attribute = wc_attribute["name"] + # if wc_product.type == "variation": + # row.attribute_value = wc_attribute["option"] + else: + for wc_attribute in wc_attributes: + row = item.append("attributes") + row.attribute = wc_attribute["name"] + if wc_product.type == "variation": + row.attribute_value = wc_attribute["option"] # Handle variants if wc_product.type == "variable":