Woocommerce full 2 way integration

Hi, It shouldn’t do that.

In our fork we had created a new field called SKU. That’s the WooCom product ID number displayed in Item master. If the Item number is present then new product in not created. In @lasalesi version there is a barcode field at the bottom of Item master.

Also Sync items from WooCommerce to ERPNext should not be ticked. Then I guess it goes into a cycle. Hope you have not configured the core WooCommerce settings.

Hi @lasalesi Hope you are well. Am getting this error on a V12 instance whenever I tick Enable woocommerce and try to save it. Tried to find the source of the issue without success

Server Error
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Heres the complete traceback

  File "/home/XXX/frappe-bench/apps/frappe/frappe/app.py", line 67, in application
    response = frappe.api.handle()
  File "/home/XXX/frappe-bench/apps/frappe/frappe/api.py", line 59, in handle
    return frappe.handler.handle()
  File "/home/XXX/frappe-bench/apps/frappe/frappe/handler.py", line 24, in handle
    data = execute_cmd(cmd)
  File "/home/XXX/frappe-bench/apps/frappe/frappe/handler.py", line 64, in execute_cmd
    return frappe.call(method, **frappe.form_dict)
  File "/home/XXX/frappe-bench/apps/frappe/frappe/__init__.py", line 1105, in call
    return fn(*args, **newargs)
  File "/home/XXX/frappe-bench/apps/frappe/frappe/desk/form/save.py", line 21, in savedocs
    doc.save()
  File "/home/XXX/frappe-bench/apps/frappe/frappe/model/document.py", line 273, in save
    return self._save(*args, **kwargs)
  File "/home/XXX/frappe-bench/apps/frappe/frappe/model/document.py", line 309, in _save
    self.run_before_save_methods()
  File "/home/XXX/frappe-bench/apps/frappe/frappe/model/document.py", line 901, in run_before_save_methods
    self.run_method("validate")
  File "/home/XXX/frappe-bench/apps/frappe/frappe/model/document.py", line 802, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
  File "/home/XXX/frappe-bench/apps/frappe/frappe/model/document.py", line 1081, in composer
    return composed(self, method, *args, **kwargs)
  File "/home/XXX/frappe-bench/apps/frappe/frappe/model/document.py", line 1064, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
  File "/home/XXX/frappe-bench/apps/frappe/frappe/model/document.py", line 796, in <lambda>
    fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
  File "/home/XXX/frappe-bench/apps/woocommerceconnector/woocommerceconnector/woocommerceconnector/doctype/woocommerce_config/woocommerce_config.py", line 17, in validate
    self.validate_access()
  File "/home/XXX/frappe-bench/apps/woocommerceconnector/woocommerceconnector/woocommerceconnector/doctype/woocommerce_config/woocommerce_config.py", line 26, in validate_access
    r = get_request('settings', {"api_key": self.api_key,
  File "/home/XXX/frappe-bench/apps/woocommerceconnector/woocommerceconnector/woocommerce_requests.py", line 68, in get_request
    return get_request_request(path, settings).json()
  File "/home/XXX/frappe-bench/apps/woocommerceconnector/woocommerceconnector/woocommerce_requests.py", line 60, in get_request_request
    message="{0}: {1}".format(r.url, r.json()),
  File "/home/XXX/frappe-bench/env/lib/python3.8/site-packages/requests/models.py", line 897, in json
    return complexjson.loads(self.text, **kwargs)
  File "/usr/lib/python3.8/json/__init__.py", line 357, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.8/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.8/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Thanks for the help.

I think this is related to json support on your website. On wordpress a person should go to their website_address/wp-json and confirm that it does not throw an error, if it does google that error and u should have a solution on how to enable json on your site.

If your wordpress has an error when you do website_address/wp-json then do this " go to Settings > Permalinks and change the setting to “Post name” to get it to work for you. I would be cautious about doing this if you already have a live site as it will modify a lot of your urls." borrowed verbatim from here

Again thanks for even finding the time to reply to me. This is why I feel that we need a comprehensive guide so that we can have an idea of at least what each of the options do. First I had already setup the core wooCom integration and I had to disable it. Then I had selected Sync items from WooCommerce to ERPNext but then disabled it. So how how does one do this right? For instance where do I create the item first WooCom or Erpnext? Say I already have an item in Erpnext and I sync it with WooCom to create a new draft item, what happens? Coz I assume a new item will be created in WooCom with a WooCom ID. is that right? after I edit that draft and publish it what happens when I sync with erpnext again? Does erpnext and woocom treat the same items as the same? i.e. if I update stock in erpnext will that reflect in woocom?

@Muzzy
Thanks for sharing your experience using the woocommerce, you have contributed very much to the discussion.

I would like to ask confirm if this link below is proper fork where you implemented SKU.

Do I need to Edit the Woocommerce Config form and Include SKU as part of options?

My challenge is that, after the first sync to woocomerce endpoint, Any further changes like Price field made to the items on ERPnext does not get synced.
The API call reports duplicate

Our fork is this. You don’t need to new SKU field in ERPNext. It will reflect in Item Master.

Thank for a quick response.
Very Good, I am using this particular fork.
My issue is that Sync does work after the first run.

It is show error 400: Duplicate

I found out that Sync product to woocommerce Works If I manually insert the WooCommerce ID of the item.
I edit the Item form and Enable the field for woocommerce_product_id

I think the problem is Sync Woocommerce IDs to ERP is not working
It returning empty
add_w_id_to_erp

After installing this version and trying to upload items, almost everything is working correctly but the WooCommerce product id did not update automatically

if there is a reason for that what it will be?


and it completed successfully

also what i notice even if there is default customer for guest still the system create new user for every order from guest

Can you share you setting page of ERPNext? It shouldn’t create Guest if defined in the settings.

If WooCommerce sales is on Guest customer then while syncing orders, ERPNext will use selected customer for order creation

Sorry for the late response but I being sick the past few days

this is my settings


and this is the default customer

it seems , i miss the mention
sorry to bother you but can you see my settings if i do something wrong?
or everything fine and i need to work around

Hi,
Did you get any fix for this? Even I am getting the same now.

BTW: Thanks for your contributions as well, towards this connector.

Sorry guys. Haven’t tested on V13. It works fine on V11 and V12.

If you already have products on WooCommerce then update the item WooCommerce code to ERPNext via data upload. Uncheck sync item from WooCommerce to ERPNext. Have only 1 item master creator which is ERPNext.

1 Like

Is the WooCommerceConnector app an additional app to sync ERPNext with WooCommerce (item, stock, etc) or is it the same implicit app that both apps use to connect to each other? And Is this app functional for v13?

Por fin despues de estar halandome los pelos durante 2 semanas por fin lo hice funcionar. Verificado que si funciona la sincronizacion de productos en la version 13.

1 Like

It correctly synchronizes orders, customers between ERPNext v13 and woocommerce connector.

A thank you to @lasalesi @Muzzy for his work.

1 Like