Try ERPNext Buy Support Partners Foundation

Woocommerce and woocommerce conector sync problem

Hello @lasalesi

Thanks for all the efforts you’ve been giving to support this integration, here I have some troubles, hopefully you may have some way to know what’s going on

Current versions:

  • ERPNEXT V12.10.1
  • Frappe 12.8.3
  • Woocommerce 4.3.1

For now

  1. ‘Sync Woocommerce IDs to ERP’ duplicate products in draft in woocommerce every time you sync, ( all items with the sync to woocommerce check selected*).

  2. Sync woocommerce ends in error:

Traceback (most recent call last):
File “/home/frappe/frappe-bench/apps/woocommerceconnector/woocommerceconnector/sync_products.py”, line 132, in sync_erpnext_items
sync_item_with_woocommerce(item, price_list, warehouse, woocommerce_item_list.get(item.get(‘woocommerce_product_id’)))
File “/home/frappe/frappe-bench/apps/woocommerceconnector/woocommerceconnector/sync_products.py”, line 243, in sync_item_with_woocommerce
sync_item_image(erp_item)
File “/home/frappe/frappe-bench/apps/woocommerceconnector/woocommerceconnector/sync_products.py”, line 270, in sync_item_image
post_request(“products/{0}”.format(item.woocommerce_product_id), image_info)
File “/home/frappe/frappe-bench/apps/woocommerceconnector/woocommerceconnector/woocommerce_requests.py”, line 69, in post_request
r.raise_for_status()
File “/home/frappe/frappe-bench/env/lib/python3.7/site-packages/requests/models.py”, line 940, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://[[ WEBSITE LINK]]/wp-json/wc/v3/products/169

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/home/frappe/frappe-bench/apps/woocommerceconnector/woocommerceconnector/api.py”, line 41, in sync_woocommerce_resources
sync_products(woocommerce_settings.price_list, woocommerce_settings.warehouse)
File “/home/frappe/frappe-bench/apps/woocommerceconnector/woocommerceconnector/sync_products.py”, line 19, in sync_products
sync_erpnext_items(price_list, warehouse, woocommerce_item_list)
File “/home/frappe/frappe-bench/apps/woocommerceconnector/woocommerceconnector/sync_products.py”, line 139, in sync_erpnext_items
make_woocommerce_log(title=e.message, status=“Error”, method=“sync_woocommerce_items”, message=frappe.get_traceback(),
AttributeError: ‘HTTPError’ object has no attribute ‘message’

  1. Also I wanted to ask, is there a way to sync pictures too?

@EnSeal @zerodiscount

Are you using the barcode field wo match the items? This is usually a rather stable way and should not give you double products. The bad request error occurs when you are trying to sync stock against an invalid product key in WooCommerce. Please check the WooCommerce Ids stored in ERPNext, you will find an ID that actually is not in WooCommerce (or a product that is set to sync stock but has no WooCommerce-ID).

The image function in WooCommerce is somewhat more powerful than in ERPNext, therefore, a simple sync of the images. However, the first image from WooCommerce should be synced to new items created in ERPNext. Is that what you are looking for (or the other way round)?

Yes I am using barcode fields, but is my first sync so I won’t have any products in WooCommerce end, Do I have to make a first product upload first maybe through CSV?

Awesome working! I had to match the barcode.

Can we use item_code instead of the barcode?

Also can you point me out in the code where can I add more fields to sync, like tags, item group, item group parent?

Great to hear! I guess especially the latest release with the improved error handling should have brought light into this.

We do not use item code because it is used more freely within ERPNext. But you can use any unique code.

Look at the sync_products.py file for the variables on the interface: