Current Behavior
Summary
sync_items.py line 271 calls json.loads(woocommerce_product.images)
unconditionally during variation sync. WooCommerce's variation REST
response uses image (singular object) not images (array), so
.images is None and json.loads raises TypeError.
Stack trace
File "apps/woocommerce_fusion/woocommerce_fusion/tasks/sync_items.py",
line 252, in sync_wc_product_with_erpnext_item
self.update_item(self.woocommerce_product, self.item)
File "apps/woocommerce_fusion/woocommerce_fusion/tasks/sync_items.py",
line 271, in update_item
wc_product_images = json.loads(woocommerce_product.images)
File "/usr/lib/python3.11/json/init.py", line 339, in loads
raise TypeError(...)
TypeError: the JSON object must be str, bytes or bytearray, not NoneType
Reproduction
- ERPNext template Item with has_variants=1
- Variant Items mapped to WC variation IDs via woocommerce_servers
- WC product is type=variable with variations that have their own image
- Sync runs → variation pulled via /products/{parent}/variations/{id}
- Error logged every cron tick per variant
WC REST shape
GET /wp-json/wc/v3/products/26592/variations/26614 returns:
{"image": {...}, ...} ← singular, not "images"
GET /wp-json/wc/v3/products/26614 returns:
{"images": [...], ...} ← plural array (regular product endpoint)
Suggested fix
Either:
(a) Guard the json.loads — json.loads(woocommerce_product.images or "[]")
(b) Normalize variations: when product type is "variation", wrap
image as images: [image] before update_item
(c) Use the /products/{variation_id} endpoint (returns full schema)
Environment: ERPNext v15, WooCommerce 10.x.
Steps To Reproduce
- ERPNext template Item with has_variants=1
- Variant Items mapped to WC variation IDs via woocommerce_servers
- WC product is type=variable with variations that have their own image
- Sync runs → variation pulled via /products/{parent}/variations/{id}
- Error logged every cron tick per variant
Expected Behavior
Succesful variable item sync
Anything else?
No response
Environment and Versions
- Frappe Version: v15.96.0 (HEAD)
- ERPNext Version: v15.94.0 (HEAD)
- WooCommerce Fusion: v1.17.2 (HEAD)
Hosting Method
Remote or local Docker Instance
What browsers are you seeing the problem on?
Chrome, N/A
Current Behavior
Summary
sync_items.py line 271 calls
json.loads(woocommerce_product.images)unconditionally during variation sync. WooCommerce's variation REST
response uses
image(singular object) notimages(array), so.imagesis None and json.loads raises TypeError.Stack trace
File "apps/woocommerce_fusion/woocommerce_fusion/tasks/sync_items.py",
line 252, in sync_wc_product_with_erpnext_item
self.update_item(self.woocommerce_product, self.item)
File "apps/woocommerce_fusion/woocommerce_fusion/tasks/sync_items.py",
line 271, in update_item
wc_product_images = json.loads(woocommerce_product.images)
File "/usr/lib/python3.11/json/init.py", line 339, in loads
raise TypeError(...)
TypeError: the JSON object must be str, bytes or bytearray, not NoneType
Reproduction
WC REST shape
GET /wp-json/wc/v3/products/26592/variations/26614 returns:
{"image": {...}, ...} ← singular, not "images"
GET /wp-json/wc/v3/products/26614 returns:
{"images": [...], ...} ← plural array (regular product endpoint)
Suggested fix
Either:
(a) Guard the json.loads —
json.loads(woocommerce_product.images or "[]")(b) Normalize variations: when product type is "variation", wrap
imageasimages: [image]before update_item(c) Use the /products/{variation_id} endpoint (returns full schema)
Environment: ERPNext v15, WooCommerce 10.x.
Steps To Reproduce
Expected Behavior
Succesful variable item sync
Anything else?
No response
Environment and Versions
Hosting Method
Remote or local Docker Instance
What browsers are you seeing the problem on?
Chrome, N/A