Woocommerce full 2 way integration

We have not even been able to make it work for one woocommerce instance yet…lol

Anyone apart from @lasalesi who has succeeded in making this work please holla at us.

Regards

1 Like

Sorry guys, but a quick question, there is already a woocommerce integration in v12, why the new connector ? is there something faulty with the one shipped with erpnext? or not doing sync as it must do? or a limitation? as i dont know yet
Thanks

1 Like

Hi,
Is there a way to know what field are synced with woo commerce. I tried to look at the code but I’m not sure I understand everything.

I’m currently trying a woocommerce php pluging that is sync custom fields from erpnext but I’m still very interested in your module but I would need help to integrate it. Any suggestion on who could help if you dont have time. If not I’ll post on freelancer.

Hi @a.elhaidary,

thanks for your input. The integration in v12 came later than the connector and has far as I know it does not support multiple stock locations… Apart from the install issues in v12 with the connector, it actually works very well (and these have been resolved afaik)…

No it does not

@EnSeal

Hi @olamide_shodunke,

were you successful with the integrated option? Or do you care to share your status?

@lasalesi

Unfortunately we couldn’t make the app work…the app won’t even install on v11 at all which is where we have our production instance…

While on v12 orders won’t sync back into ERPNext…

1 Like

Israel.l could you be more specific ?

What challenges did you have on v11 and what challenges did you have on v12

In my opinion your statement above is not helpful

Hi @EnSeal,
thanks for your feedback, sorry to hear that. We unfortunately no longer actively support v11, but on v12 it should in any case work. Do you have details, why the orders are not being pulled? There could be a cloud in the WooCommerce Log (sync started, …). If the connection works, items are synced, the sales order should also be able to be read…

@lasalesi does it sync inventory. Is sales invoice made in ERPNext or Sales order. Can you give more information of the 2 way functions.

I am on V12.7, python3.6 - getting the following error on bench --site erp.domain.com install-app woocommerceconnector command:

ImportError: Module import failed for Asset Settings (erpnext.assets.doctype.asset_settings.asset_settings Error: No module named 'erpnext.assets.doctype.asset_settings.asset_settings')

Will appreciate any guidance on how to resolve. Thanks.

Traceback (most recent call last):
  File "/home/frappe/frappe-bench/apps/frappe/frappe/modules/utils.py", line 204, in load_doctype_module
doctype_python_modules[key] = frappe.get_module(module_name)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 827, in get_module
return importlib.import_module(modulename)
  File "/home/frappe/frappe-bench/env/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'erpnext.assets.doctype.asset_settings.asset_settings'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
  File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 97, in <module>
main()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 18, in main
click.Group(commands=commands)(prog_name='bench')
  File "/home/frappe/frappe-bench/env/lib/python3.6/site-packages/click/core.py", line 764, in __call__
return self.main(*args, **kwargs)
  File "/home/frappe/frappe-bench/env/lib/python3.6/site-packages/click/core.py", line 717, in main
rv = self.invoke(ctx)
  File "/home/frappe/frappe-bench/env/lib/python3.6/site-packages/click/core.py", line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/frappe/frappe-bench/env/lib/python3.6/site-packages/click/core.py", line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/frappe/frappe-bench/env/lib/python3.6/site-packages/click/core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
  File "/home/frappe/frappe-bench/env/lib/python3.6/site-packages/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
  File "/home/frappe/frappe-bench/env/lib/python3.6/site-packages/click/decorators.py", line 17, in new_func
return f(get_current_context(), *args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/commands/__init__.py", line 25, in _func
ret = f(frappe._dict(ctx.obj), *args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/commands/site.py", line 179, in install_app
_install_app(app, verbose=context.verbose)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/installer.py", line 85, in install_app
add_to_installed_apps(name)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/installer.py", line 109, in add_to_installed_apps
post_install(rebuild_website)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/installer.py", line 170, in post_install
init_singles()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/installer.py", line 188, in init_singles
doc = frappe.new_doc(single)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 687, in new_doc
return get_new_doc(doctype, parent_doc, parentfield, as_dict=as_dict)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/create_new.py", line 21, in get_new_doc
frappe.local.new_doc_templates[doctype] = make_new_doc(doctype)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/create_new.py", line 39, in make_new_doc
"docstatus": 0
  File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 753, in get_doc
doc = frappe.model.document.get_doc(*args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 69, in get_doc
controller = get_controller(doctype)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/base_document.py", line 47, in get_controller
module = load_doctype_module(doctype, module_name)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/modules/utils.py", line 206, in load_doctype_module
raise ImportError('Module import failed for {0} ({1})'.format(doctype, module_name + ' Error: ' + str(e)))
ImportError: Module import failed for Asset Settings (erpnext.assets.doctype.asset_settings.asset_settings Error: No module named 'erpnext.assets.doctype.asset_settings.asset_settings')

Could fix it - dont know if it is right way - with following commands:

$ bench mariadb
> delete from `tabDocType` where `name` = "Asset Settings";

Was able to install-app after the above command. However bench update then fails / gives error:

ERROR: Command errored out with exit status 1:
 command: /home/frappe/frappe-bench/env/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/home/frappe/frappe-bench/apps/woocommerceconnector/setup.py'"'"'; __file__='"'"'/home/frappe/frappe-bench/apps/woocommerceconnector/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-cpxffbnt
     cwd: /home/frappe/frappe-bench/apps/woocommerceconnector/
Complete output (7 lines):
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/frappe/frappe-bench/apps/woocommerceconnector/setup.py", line 27, in <module>
    install_requires=[str(ir.req) for ir in requirements],
  File "/home/frappe/frappe-bench/apps/woocommerceconnector/setup.py", line 27, in <listcomp>
    install_requires=[str(ir.req) for ir in requirements],
AttributeError: 'ParsedRequirement' object has no attribute 'req'
----------------------------------------
`ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.`

Uninstalled the app for the site and then did a bench remove-app . Attempted to reinstall it. Get error on get-app command now. Seems cannot uninstall / remove app and reinstall it. Restored container from snapshot.

Appreciate any pointers.

I have this same error, can I ask how you solve this issue?

1 Like

I have the same error trying to “get-app”

INFO:bench.app:installing woocommerceconnector
$ ./env/bin/pip install -q -U -e ./apps/woocommerceconnector
    ERROR: Command errored out with exit status 1:
     command: /opt/erpnext/erpnext/env/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/opt/erpnext/erpnext/apps/woocommerceconnector/setup.py'"'"'; __file__='"'"'/opt/erpnext/erpnext/apps/woocommerceconnector/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-doxlg29b
         cwd: /opt/erpnext/erpnext/apps/woocommerceconnector/
    Complete output (7 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/opt/erpnext/erpnext/apps/woocommerceconnector/setup.py", line 27, in <module>
        install_requires=[str(ir.req) for ir in requirements],
      File "/opt/erpnext/erpnext/apps/woocommerceconnector/setup.py", line 27, in <listcomp>
        install_requires=[str(ir.req) for ir in requirements],
    AttributeError: 'ParsedRequirement' object has no attribute 'req'
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
$ bench build --app woocommerceconnector
Traceback (most recent call last):
  File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/opt/erpnext/erpnext/apps/frappe/frappe/utils/bench_helper.py", line 97, in <module>
    main()
  File "/opt/erpnext/erpnext/apps/frappe/frappe/utils/bench_helper.py", line 18, in main
    click.Group(commands=commands)(prog_name='bench')
  File "/opt/erpnext/erpnext/env/lib/python3.6/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/opt/erpnext/erpnext/env/lib/python3.6/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/opt/erpnext/erpnext/env/lib/python3.6/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/opt/erpnext/erpnext/env/lib/python3.6/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/opt/erpnext/erpnext/env/lib/python3.6/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/opt/erpnext/erpnext/env/lib/python3.6/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/opt/erpnext/erpnext/apps/frappe/frappe/commands/utils.py", line 25, in build
    frappe.init('')
  File "/opt/erpnext/erpnext/apps/frappe/frappe/__init__.py", line 173, in init
    setup_module_map()
  File "/opt/erpnext/erpnext/apps/frappe/frappe/__init__.py", line 1015, in setup_module_map
    for module in get_module_list(app):
  File "/opt/erpnext/erpnext/apps/frappe/frappe/__init__.py", line 884, in get_module_list
    return get_file_items(os.path.join(os.path.dirname(get_module(app_name).__file__), "modules.txt"))
  File "/opt/erpnext/erpnext/apps/frappe/frappe/__init__.py", line 842, in get_module
    return importlib.import_module(modulename)
  File "/opt/erpnext/erpnext/env/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'woocommerceconnector'

Hi @zerodiscount,

sorry for the late response, but the “Asset Settings” issue is unrelated to WooCommerce…

The ‘req’ issue is a Python compatibility issue. I noted that the setup still had the old version code, this is now updated.

Thanks @lasalesi for the reply - better late than never… appreciate the contributions.

$ bench mariadb
> delete from `tabDocType` where `name` = "Asset Settings";

Is it ok to resolve the “Asset Settings” issue with above commands? Half knowledge is dangerous - and I dont know if above command will break other part of ERPNext . I did check - there is no category called Asset Settings in ERPNext - so is it something being called by your app?

@lasalesi - had another question related to functionality - will this app create a payment entry in ERPNext for orders that are paid in woocommerce (using woocommerce payment gateways)?

Asset Settings is a normal doctype:


this is a screenshot from a v12.1 instance…

When I checked on a v12.4 instance, this doctype is gone… So this must have been removed lately, and this causes your issue. But has nothing to do with the WooCommerce integration. From what I see, if you run v12.4 or later, it should be save to drop this table.

As far as I know, the connector does not sync the payment entries, but the sales invoices (in case of payment with the is_paid option).

@lasalesi - many thanks for the follow up. I was able to install the app and actually get sync to work partially / initially. Its sync’s IDs without issue and even synced a trial customer - which existed in erpnext - so it created a new one with a “-1”. Products in woocommerce were specified as a separate erpnext category. when I tried to get some regular erpnext product items to sync - i get the following error:

File "/home/frappe/frappe-bench/env/lib/python3.6/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: http://shop.domain.com/wp-json/wc/v3/products/607?oauth_consumer_key=ck_MY-Key_9c&oauth_timestamp=1588799441&oauth_nonce=123abc_Nonce_def&oauth_signature_method=HMAC-SHA256&oauth_signature=dT_MySignature_%3D

By this I meant - I check marked for items - sync quantity with woocommerce and also the other checkmark to sync item with woocommerce…

You can only sync stock once the connection between the item in WooCommerce and ERPNext is established. This should be the case, as you have synced the IDs… Have you tried to troubleshoot the URL if this has an issue (e.g. using Postman)?