WooCommerce connector for Tryton

As discussed on Minimal e-shop for Tryton it makes sense to have a web frontend for selling Tryton. II think it makes sense to be able to have some connectors for people that already have a webshop and they want to sync it with Tryton. I think we should develop one for WooCommerce, as it’s been widely used nowadays. This connector will reuse the the web_shop module from the minimal webshopt but create a new module (web_shop_woocommerce) to sync data with woocommerce.

The WooCommerce REST API can be used to retrieve and push data to WooCommerce. There is an available Python Wrapper for it, so It makes sense to us it.

Using this wrapper we can create the following cron jobs:

  • Export products data to WooCommerce
  • Sync products stock with WooCommerce
  • Import Customer Orders from WooCommerce: Download customer orders and it’s related data from woocommerce to Tryton.

There are several order states on WooCommerce so once the order progress on Tryton, we should upate the states back to woocoomerce so the customer knows that he’s order has been updated.

  • Pending Payment and On-Hold orders should be on Tryton’s Quotation
  • Processing order should be on Tryton’s Processing state.
  • Once the shipment is sent, the order should be in *Completed" woocommerce state.

I think this should be the default behaviour of Tryton but It should be configurable per Tryton shop. So I propose to store the WooCommerce state field on the Sale and allow the developer to customize the state. A task in the queue should be responsible to sync the WooCommerce state with the webshop.

1 Like

I think this part should be very configurable because for example some will manage stock in WooCommerce, others not etc.

I do not think it is needed to have a order stats synchronization. We can only create completed order in Tryton and deal with the refund state.

I do not think WooCommerce order workflow is really configurable.

But the biggest difficulties are the taxes, the party two-way synchronization and the stock management.

I already did such development for a customer and the WooCommerce API is not really good for synchronization. You mainly have to loop over all records. Or you can store the last sync ID and loop until reaching this ID.

I do not think we need to do two-way party sincronization. For me we can try to find existing parties by it’s tax_identifier or email.

Then the parties can be merged back using the merge wizard.