Module Woocommerce EN

From Dolibarr ERP CRM Wiki
Jump to navigation Jump to search

Overview

Module Name WooSync
Editor / Editeur Open-DSI
Download or buy page / Page achat ou téléchargement
Status / Statut / Estado Stable
Prerequisites / Prérequis
  • Dolibarr min version 4.x
  • Woocomerce min version 3.x
Last update date / Date mise à jour fiche / Fecha última actualización 2024-01-3
Note / Nota WooSync is a fork of EcommerceNG developed by TecLib

Feature/Plugin

WooSync synchronizes data between WooCommerce and Dolibarr : thirdparties and contacts, products, orders... automatically from Dolibarr to WooCommerce and manually from WooCommerce to Dolibarr.

Development

The development of this module is not included into the standard GIT repository of Dolibarr; but inside a dedicated repository, managed by Open-DSI.

Installation

WooSync module has to be installed in your Dolibarr directory htdocs/custom to work properly. To connect to Woocommerce app, Dolibarr uses by default Woocommerce's WebServices (REST API v2).

Dolibarr module

  • Download the archive file of module (.zip file)
  • Unzip the folder into the htdocs/custom directory of your Dolibarr.
  • Module is then visible into list of available modules (Home > Setup > Modules/applications) and can be activated.

Setup on Woocomerce side

  • The option Enable guest checkout had better be disabled;
  • The New User Default Role has to be set on "Client";
  • WooSync has been tested without any other application than WP Oauth server and WP Mail SMTP by WPForms.

Setup on Dolibarr side

From Home > Setup > Other, hidden rules can be enabled :

  • ECOMMERCENG_DISABLE_LOG_IN_NOTE at 1 to disable the log in the private note of orders from WooCommerce in Dolibarr;
  • ECOMMERCENG_SHOW_DEBUG_TOOLS at 1 to show init/purge/debug tools into site page;
  • ECOMMERCENG_DISABLED_ERROR_FOR_SOCIETE_ID_0 at 1 to disable the error at the creation of an order when societe id = 0 (administrator, anonymous, ...);
  • ECOMMERCENG_SHOW_DEBUG_TOOLS at 1 to display debug options;
  • ECOMMERCE_WOOCOMMERCE_DEFAULT_TVA at 1 to set default TVA rate to use;
  • ECOMMERCENG_ENABLED_SYNCHRONIZE_IMAGES_PRODUCT_BUTTON at 1 to display the button to force picture synchronization on lnked files tab of product card;
  • ECOMMERCENG_WOOCOMMERCE_DISABLED_SYNCHRO_IMAGE at 1 to prevent picture synchronization;
  • ECOMMERCENG_SHIPPING_NOT_DISPLAY_IF_NULL at 1 not to display free shipping fees on Dolibar orders.

Items Synchronization between Dolibarr and WooCommerce

The WooCommerce ⇒ Dolibarr synchronization is made by a manual operation : It requires the user to click on "Woocommerce to Dolibarr sync" button.

The Dolibarr ⇒ WooCommerce synchronization is made in real time. No manual operation is required.

Items Synchronization Action Comment
Categories

(thirdparties & products/services)

Dolibarr ⇒ WooCommerce None In a future version, categories created in Dolibarr will be synchronized in WooCommerce
WooCommerce ⇒ Dolibarr They are synchronized as sub-categories of the parent category declared in Dolibarr (WooCommerce module settings) Table llx_ecommerce_category is updated to save the link between Dolibarr category id and remote WooCommerce id.

Warning > Due to the fact that there is no option to search the last modified categories, their synchronization might be slown down by the high number of categories.

Thirdparties & contacts Dolibarr ⇒ WooCommerce None
WooCommerce ⇒ Dolibarr Thirdparties are created in Dolibarr as customers in the category declared in the module setting page. Shipping and billing addresses are created as contacts. WooSync checks email adresses before creating a new thirdparty. Synchronized data :
  • Company Name (if filled in, thirdparty name. If not, thirdparty is created as a contact)
  • Lastname
  • firstname
  • Adress
  • ZIP
  • Town
Products / Services Dolibarr ⇒ WooCommerce Products are synchronized in real time if they are linked to the ecommerce category declared in the module setup.

Pictures are synchronized in real time. Several rules can be enabled (See above : "Setup on Dolibarr side").

Synchronized data :
  • Product (event PRODUCT_MODIFY)
    • Réf. ⇒ UGS;
    • Label ⇒ Name;
    • Status (published (for sale) or pending);
    • Description ⇒ empty;
    • Description boutique ⇒ Description;
    • Description courte boutique ⇒ Short description;
    • Price ⇒ Régular price;
    • Weigth (Kg)
    • Stock quantity;
    • In stock
  • Product Variant

We recommand to create variant in WooCommerce.

WooCommerce ⇒ Dolibarr They are set up in Dolibarr and linked to the category declared in the module setup.

If the module Suppliers is enabled and Stock synchronization direction is set on Ecommerce to Dolibarr, products will be initialised/updated in the warehouse defined in the WooSync module setup in Dolibarr.

Variants have to be created in WooCommerce. They will be synchronized as product/services in Dolibarr.

Synchronized data :
  • Product type ⇒ Product or Service if set as "virtual"
  • UGS ⇒ Ref.

Note > It requires the activation of 'Elephant' code generator in Dolibarr module Products/services

  • Name ⇒ Label
  • Description ⇒ empty
  • Statut pour le site "boutique_wordpress" ⇒ Status
  • Description ⇒ Description boutique
  • Short description ⇒ Description courte boutique
  • Tag/category ⇒ Category
  • Weigth (Kg) ⇒ Weight
  • Price ⇒ Price
  • En vente ⇒ Purchasable
  • Product finished type ⇒ Fixed at Manufactured
  • Min price ⇒ Price
  • Url ⇒ Permalink
  • Stock quantity ⇒ Stock quantity


Product Variation :

  • Product type ⇒ Service if set as "virtual"
  • UGS ⇒ Ref.
  • Name ⇒ Label
  • Description ⇒ empty
  • Weigth (Kg) ⇒
  • Price ⇒
  • Purchasable ⇒ to sell
  • Product finished type ⇒ Fixed at Manufactured
  • Price ⇒ Price
  • Permalink ⇒ URL
  • Stock quantity ⇒ Stock quantity

Other fields are retrieved from the parents products.
Table llx_ecommerce_product is updated to remember the link between dolibarr product id and remote Woocommerce id

Orders Dolibarr ⇒ WooCommerce Orders created in Dolibarr are NOT synchronized.

Only modified status in Dolibarr will be updated on orders synchronized from WooCommerce (a link has to be present)

Status synchronization (events ORDER_MODIFY, ORDER_CLOSE and ORDER_CLASSIFY_BILLED) :
  • Cancelled ⇒ cancelled;
  • Validated ⇒ pending;
  • Accepted & shipment on process ⇒ processing;
  • Closed ⇒ completed.
WooCommerce ⇒ Dolibarr They are also created in Dolibarr Note > The orders created by another person than Customer user (Administrator, Anonymous, ...) are not created/modified

Synchronized data :

  • Ref client ⇒ Id order in Woocommerce
  • Purchase order date ⇒ Created date in Woocommerce
  • Delivery date ⇒ Completed date in Woocommerce
  • Status
    • Pending ⇒ Validated,
    • On-hold & processing ⇒ Accepted,
    • Cancelled & Failed ⇒ Cancelled,
    • Completed & Refunded ⇒ Closed;
  • Payment status
    • Pending & processing & on-hold & cancelled & Failed ⇒ Not paid
    • Completed & Refunded ⇒ Paid
  • Private note ⇒ Customer's notes in Woocommerce
  • Product ⇒ Description (Name in Woocommerce);
  • Product type ⇒ Fixed at Simple
  • Price ⇒
  • Quantity ⇒
  • VAT rate (Calculated with total and total tax closed to VAT rate in Dolibarr) ⇒
  • Shipping line of the product (Displayed by default or ECOMMERCENG_SHIPPING_NOT_DISPLAY_IF_NULL)
  • Description ⇒ Shipping - ' & Shipping method title in Woocommerce if present
  • Price ⇒ Total shipping in Woocommerce
  • VAT rate (Calculated with shipping total and shipping tax closed to VAT rate in Dolibarr)||
  • Order address ⇒ Billing Contact/addresses in Thirdparties
  • Invoice address ⇒ Billing Contact/addresses in Thirdparties
  • Shipping address ⇒ Shipping Contact/addresses in Thirdparties

Table llx_ecommerce_order is updated to remember the link of dolibarr order id and remote Woocommerce id

Shipment Dolibarr ⇒ WooCommerce Shipments are created from orders in Dolibarr. Orders status are updated and synchronized in real time in WooCommerce (see above).
WooCommerce ⇒ Dolibarr None None
Invoices Dolibarr ⇒ WooCommerce Invoices are created from shipments in Dolibarr.
WooCommerce ⇒ Dolibarr None None