WooCommerce connector for Tryton

There is an API parameters property that can be overriden to match custom requirements.

Why not? The property can be overriden in custom module so you can pass any arguments to the API constructor and make it work for any use case.

I understand, but to create a new custom module to just add that one parameter seems a lot of work and was just thinking about it. It’s almost impossible to put this into the trytond.conf because you can have multiple shops.

When you look at the variables, you can see a pattern like <key>="<value>". What about doing that also in the module? Replacing all the woocommerce fields in the shop class with a text field and on each line you enter the key=value. The property then splits those based on the newline character, maybe add some checking if the key is allowed etc. With this, you are giving the user great flexibility but also the responsibility to add the right data correctly.

Was just thinking about it.

This may work but for us normally it’s easier to extend the code on a third party module instead of having configuration on the database because it may allow to hide the api internals to the end users.

With again very patient help by @edbo I could make it work partially. His (he said “hacky”) solution was:

  1. in (name-of-your-environment)/web_shop_woocommerce/build/lib/trytond/modules/web_shop_woocommerce/web.py,

def woocommerce_api_parameters(self):
return {
‘url’: self.woocommerce_url,
‘consumer_key’: self.woocommerce_consumer_key,
‘consumer_secret’: self.woocommerce_consumer_secret,
‘timeout’: 30,

(which occurs around line 168) to

def woocommerce_api_parameters(self):
    return {
        'url': self.woocommerce_url,
        'consumer_key': self.woocommerce_consumer_key,
        'consumer_secret': self.woocommerce_consumer_secret,
        'timeout': 30,
        'query_string_auth': True,
  1. Reinstall the woocommerce module.

This at least made the “import orders” feature work; “import products” still does not.

Now, I receive orders as “posted” ones. In my case, this is not the ideal solution. My customers often purchase one service from the web shop, but when I receive their items, I see that they did not choose the appropriate service, and have to change or enhance their order.

Therefore: Is it possible to introduce an option where I can choose:
plugin provides

  • posted order or
  • draft order

The orders are confirmed because normally the customer have paid for it and you can not modify them.

You should consider using the sale_amendment module to update the of details of the sale.

1 Like

This may be the case often. But I think not always. A customer

  • may ring me up of mail me after a purchase that he forgot something,
  • … or accidentally ordered too much or wrong
  • I notice that one of the items ran out of stock and I will not sell them any longer

There are so many cases of error, misunderstanding or whatever… I again would vote of an option to receive a “draft” status - which I can finish then. Legally, this always should be allright if both parties agree.

If that’s difficult to implement, only import parties from woocommerce would be a usable compromise.

With the “sale_amendment” module, I get an error when I try to change an article:

Traceback (most recent call last):
  File "/trytond/wsgi.py", line 110, in dispatch_request
    return endpoint(request, **request.view_args)
  File "/trytond/protocols/dispatcher.py", line 47, in rpc
    return methods.get(request.rpc_method, _dispatch)(
  File "/trytond/wsgi.py", line 77, in auth_required
    return wrapped(*args, **kwargs)
  File "/trytond/protocols/wrappers.py", line 131, in wrapper
    return func(request, pool, *args, **kwargs)
  File "/trytond/protocols/dispatcher.py", line 186, in _dispatch
    result = rpc.result(meth(inst, *c_args, **c_kwargs))
  File "/trytond/model/fields/field.py", line 116, in wrapper
    return func(self, *args, **kwargs)
  File "/trytond/modules/sale_amendment/sale.py", line 409, in on_change_with_product_uom_category
    return self.line.product_uom_category.id
AttributeError: 'NoneType' ob

NB: The “download products” still does not work in my setup.


I am also very interested in this woocommerce connector.

I installed it like described here WooCommerce connector for Tryton

The method “Update WooCommerce Products” works fine, i can push my products from tryton to woocommerce - including stock, SKU, name. But the method “Download WooCommerce Orders” seems to have no effect. I get no error, but it also won’t download the orders. I manualy checked the API response and it’s fine. SKUs also seem to be identical (Although the difference between, and the naming of, “code” and “SKU” in Tryton is not clear to me)

What could i do next in order to identify whats going wrong?

Edit: Is it possible to execute “Download WooCommerce Orders” with trytond in a terminal, to get additional infos?

I also made a fork https://gitlab.com/Nemo123/web_shop_woocommerce where I added the line:

'query_string_auth': True,

As discussed earlier in this thread.

However this doesn’t change a thing for me. API response is fine both ways.

Did you have any confirmed order on the Woocommerce shop?

The module will raise an Error if there is some problem syncronizing.

Yes, i have a few orders with woocommerce status “completed”, “processing” and “cancelled”.

Hmm…? Where am i supposed to see the downloaded orders in tryton, under Sales > Sales?

What i did inside tryton is roughly the following: I set up one party and one product. I used Inventories to stock up the warehouse with the product. I created a webshop and asigned it to the party, the warehouse and the product. Now i can push the stock amount, price etc. from tryton to woocommerce but i don’t see the downloaded orders.

Only on-hold orders are downloaded and then it’s status is update to processing on Woocomerce.
Then when the goods are sent the order is marked as Completed on WooCommerce.

1 Like

It works :heart_eyes:

1 Like

I’ve updated the module documentation to explain how the module works. I hope this makes it easier for others to properly understand the behaviour of the module. Let me know if there is something else that need to be clarified.

Happy to read feedback from happy users!


New year, new attempt.

Sorry, still I’m not happy with an invoice I cannot change.

  • We’re on holidays. Orders came in, but we’re not working. So invoice date would be in the last year, although actual shipping happens next week, nearly mid of January. Not nice.
  • Customer purchased wrong shipment method - I cannot change that without hassle.

Sorry having to insist - but still it does not work for me this way.

In the meanwhile, I understood that products to be synced need to be added under
[menu] > sales > settings > webshops - articles
Actually, these are synced now.

I could not find how to achieve it the other way - download from woocommerce to tryton.

I do not know why you are having issues with invoices as the connector does anything with them.

For me the current workflow is correct. The connector downloads the sales order with the date of the customer order and leaves it as processing. Then invoice is created depending following your default invoice method but is always created in the draft state so you can adjust the invoice date to the previous fiscalyear if required.

Uuuuuuuh. I need to dress in sackcloth and ashes (hope this saying is correct in English)

And - especially for @pokoli - with your “¡”:
¡Mea Culpa!

You’re completely right - it was me to mess up the “order form” and the “invoice”. Obviously, they are not the same thing - but not obvious enough for my stupid mind.

Please accept my sincere apologies - I should have thought a little more about that!

Remains one thing: How do I mark items in woocommerce to be downloaded to tryton?
Once I know that, I’ll try to get a little more familiar with the module and then try to write a little HOWTO.


You don’t it.

The process is as follow:

  • Products are categories are created on tryton.
  • Once added to a woocommerce web_shop they are uploaded to woocommerce.
  • Once there is a sale in woocommerce is downloaded in tryton

If you have an existing woocommerce website with products that you want to manage from tryton you should import them in tryton and set the proper woo_commerce_id on the tryton models so the system will correctly link them and do not create duplicate products on the next sync.

A post was split to a new topic: Deleting products added to a web shop

Hi all,

in Tryton I have a product with variants and attributes.
When uploading this product to WooCommerce, each of the product variant is uploaded as an independent product in woocommerce.

Is there a way to to upload a Tryton-product with variants and attributes, for example, as variable WooCommerce product with its corresponding variants and attributes?

Thanks and all the best,

Hi Jan,

When we initialy developed the cconnector we did not have any use case for the multiple variants. For this reason we did not implement this part.

As far as this configuration can be created from the API i do not see any problem to adapt the connector to support this case.

If you want to work on this I will be happy to review your work and include it on the woocommerce module.