Woocommerce full 2 way integration

Thanks. Welcome everyone’s comments on this “requirements” document below. I don’t think I have covered everything perfectly. But pls. join in and add your comments. I will update it.

3 Likes

I think if anyone has an idea why the error message “not found” appears when trying the existing “WooCommerce Settings” doctype record, this would be all that is required… And strangely, this only affects fresh V12 installations, but not installations that come from earlier versions (or forks for that matter)…

So why can it fail to open a Doctype (Doctype List → WooCommerce Settings → Open WooCommerce Settings")?

@lasalesi i think in earlier versions the hook overwrites the default woocommerce settings doctype but in v12 the path has changed. Once you install woocommerceconnector, the default woocommerce settings page disappears from Integrations module while the custom app appears in desk as as new module so i think the issue might be the hooks and where woocommerce settings doctype is supposed to appear. I’m not a developer so my feedback here is just guesswork based on my user experience and limited knowledge of how custom doctypes are rendered.

Can we get a ERPNext developper take a look at this? We need this working and it looks like it’s a little thing that prevent it to work. I’n ready to pay for that.

2 Likes

Could you check if the documentation I wrote helps your requirements? I can take a crack at it.

I was able to solve the issues of not being able to get access to any of the module doctypes ( Blank screen in the WooCommerce Connector) and the other of the “WooCommerce Settings” specifically causing the “Sorry! …” message.

I have yet to verify the functionality of the plugin!!

Running an existing installation of Ubuntu 18.04 , ERPN 12.5

I did two different things.

First off, to get the two different doc.types to even display in the WooCommerce Connector Module, instead of the the blank page that I was seeing, I removed an extra comma in the woocommerceconnector.py file. I forked the author’s repository with the fix and comments. He should merge that asap. You can see the change in his github repo.

Next, to gain access to the “WooCommerce Settings” Doc, from the WooCommerce Connector Module, the Desk, I did the following:

  1. I restarted the site in developer mode.

  2. Logged in as the Administrator user. The Original Administrator user, not a System Manager

  3. Navigated to the Customization Module, then Doc Types

  4. I opened the “WooCommerce Settings” doctype and removed all the mandatory checks except the “app_type” then saved the doc.

  5. Then I renamed the doctype to “Woocommerce Settings 2” and saved.

  6. I then checked the box in the upper left of the doctype that says “go to woocommerce settings 2” and I was able to see the document easily.

  7. I removed all values in any of the fields and saved the doc.

  8. Back to the Customization Module, then Doc Types to edit the doctype one last time, by renaming it back to “WooCommerce Settings” and saving.

  9. Restarted bench and it was smooth sailing from there. The doc was able to be opened from the normal module on desk.

I hope this helps other folks … and a big thanks to the original app developer for making the app happen. I know it’s a more of a specific module, but if it works as described it can be very useful to many people.

Off to bed for me!!

Cheers

Good work @toceguera

When you say you got it to work have you been able to sync inventory from ERPnext to Woocommerce ?

Regards

1 Like

Thanks @olamide_shodunke .

I should be clearer in my description (it was 3:30 am when I wrote it ) What I meant was that I was able to access the all the settings without issue. I have not yet tested actual functionality of the sync.

guess I will update my post to be more clear.

Cheers

Nice! What I did was renaming the “WooCommerce Settings” to singular, and also normalized the case on all the names, you will stump with the error where no “barcode” field is found on Item doctype, this is because this version has not only one barcode per Item, but many, so it’s on another table, what I did was replace it with “item_code” directly. I’m currently stucked there, my products aren’t been imported from my woocommerce store but I can connect and check on products withing the methods. I will be doing some code reviewing this weekend and see how it goes.

2 Likes

I made some fixes to the plugin and made a pull request to the repository. Syncing items from ERPNext to WooCommerce works, which was the most important for me right now. I haven’t tested orders yet, as we’re still setting up the shop.

In case it’s useful for anyone: GitHub - carstenblt/WooCommerceConnector: Integration App for ERPNext to connect to WooCommerce

2 Likes

Hey Carsten

Any luck with Sales Order Sync ?

I saw this post “https://erpnext.com/docs/user/manual/en/erpnext_integration/woocommerce_integration” and comparing it with what i have some things appear missing

compared to what i have setup

Is the webhook still needed on ERPNext settings and also why is the woocommerce not displaying a secret field as shown in the documentation?

1 Like

@lasalesi @EnSeal Same experience here. The secret is not being generated after saving. Also, delivery url is not being generated.

@lasalesi do you know any reason why i’m getting this error?

Traceback (most recent call last):
File “/home/flexy/frappe-bench/apps/woocommerceconnector/woocommerceconnector/api.py”, line 41, in sync_woocommerce_resources
sync_products(woocommerce_settings.price_list, woocommerce_settings.warehouse)
File “/home/flexy/frappe-bench/apps/woocommerceconnector/woocommerceconnector/sync_products.py”, line 19, in sync_products
sync_erpnext_items(price_list, warehouse, woocommerce_item_list)
File “/home/flexy/frappe-bench/apps/woocommerceconnector/woocommerceconnector/sync_products.py”, line 130, in sync_erpnext_items
for item in get_erpnext_items(price_list):
File “/home/flexy/frappe-bench/apps/woocommerceconnector/woocommerceconnector/sync_products.py”, line 157, in get_erpnext_items
erpnext_items.extend(frappe.db.sql(item_from_master, as_dict=1))
File “/home/flexy/frappe-bench/apps/frappe/frappe/database/database.py”, line 171, in sql
self._cursor.execute(query)
File “/home/flexy/frappe-bench/env/lib/python3.6/site-packages/pymysql/cursors.py”, line 170, in execute
result = self._query(query)
File “/home/flexy/frappe-bench/env/lib/python3.6/site-packages/pymysql/cursors.py”, line 328, in _query
conn.query(q)
File “/home/flexy/frappe-bench/env/lib/python3.6/site-packages/pymysql/connections.py”, line 517, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
File “/home/flexy/frappe-bench/env/lib/python3.6/site-packages/pymysql/connections.py”, line 732, in _read_query_result
result.read()
File “/home/flexy/frappe-bench/env/lib/python3.6/site-packages/pymysql/connections.py”, line 1075, in read
first_packet = self.connection._read_packet()
File “/home/flexy/frappe-bench/env/lib/python3.6/site-packages/pymysql/connections.py”, line 684, in _read_packet
packet.check_error()
File “/home/flexy/frappe-bench/env/lib/python3.6/site-packages/pymysql/protocol.py”, line 220, in check_error
err.raise_mysql_exception(self._data)
File “/home/flexy/frappe-bench/env/lib/python3.6/site-packages/pymysql/err.py”, line 109, in raise_mysql_exception
raise errorclass(errno, errval)
pymysql.err.InternalError: (1054, “Unknown column ‘woocommerce_description’ in ‘field list’”)

Hi @EnSeal,

ah, thanks for the pointer, now we now why the app is broken in V12, the same name seems to have been used for the integrations module… Makes sense that it works on upgrade but not on fresh installs. However, I can still not see the conflicting “WooCommerce Settings” (/desk#Form/Woocommerce Settings) from the integrations…

We’ll have to rename the app to “WooCommerce Config” to get it to working (@carsten, thanks for the PR, will merge it shortly). Not optimal, but should get it to working…

Order syncing with the app is working without issues.

@lasalesi My sync says success but this is my sync log:

Updated 0 customer(s), 0 item(s), 0 order(s)

Could i have done anything wrong?

@lasalesi our order sync got through the create_customer sucessfully, but is throwing the following error when syncing orders

Status
Error
Method
sync_woocommerce_resources
Message
Traceback (most recent call last):
File “/opt/bench/erpnext/apps/woocommerceconnector/woocommerceconnector/api.py”, line 43, in sync_woocommerce_resources
sync_orders()
File “/opt/bench/erpnext/apps/woocommerceconnector/woocommerceconnector/sync_orders.py”, line 15, in sync_orders
sync_woocommerce_orders()
File “/opt/bench/erpnext/apps/woocommerceconnector/woocommerceconnector/sync_orders.py”, line 21, in sync_woocommerce_orders
for woocommerce_order in get_woocommerce_orders():
File “/opt/bench/erpnext/apps/woocommerceconnector/woocommerceconnector/woocommerce_requests.py”, line 196, in get_woocommerce_orders
response = get_request_request(‘orders?per_page={0}&page={1}&{2}’.format(_per_page,page_idx+1,filter_condition))
File “/opt/bench/erpnext/apps/woocommerceconnector/woocommerceconnector/woocommerce_requests.py”, line 48, in get_request_request
r.raise_for_status()
File “/opt/bench/erpnext/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: 500 Server Error: Internal Server Error for url: https://www.{mysite}.com/wp-json/wc/v3/orders?per_page=100&page=17&

Error message on the woocommerce url
{“code”:“woocommerce_rest_cannot_view”,“message”:“Sorry, you cannot list resources.”,“data”:{“status”:401}}

Thanks in advance for your input on this matter.

@dliejardi can you share a screenshot of your configuration?

@flexy2ky here you go

@dliejardi Thanks. This seems to be what i have exactly. but while my sync says successful, nothing gets synced to woocommerce.


I have checked every setting and all seems to be fine but it just won’t sync any item to woocommerce. Apart from configuring the REST API, did you set up the web hooks or anything else?

1 Like