Using WooCommerce Integration, you can automatically create Sales Orders in ERPNext for the orders created on WooCommerce using the WooCommerce webhook. This article outlines how to integrate ERPNext with WooCommerce.
Step 1: You need to generate an API key and an API secret from the WooCommerce site. To do this, log in to the WordPress dashboard so that you can access the WooCommerce administration panel. Under WooCommerce, click on "Settings", then go to the "Advanced" tab as shown below. Click on the "REST API" link.
Step 2: Click on the "Add key" button. Enter the necessary details and click on the "Generate API key" button. You will see the generated keys like below:
Step 3: On your ERPNext site, go to "Home" > "Integrations" > "Settings" > "Woocommerce Settings". Paste the API key and secret generated in the previous step into the "API consumer key" and "API consumer secret" fields. In the "Woocommerce Server URL" paste the URL of your WooCommerce site. Make sure "Enable Sync" is checked. Select the "Tax Account" and "Freight and Forwarding Account" in the Account Details Section. Select the "Creation User" in the Defaults section. This user will be used to create Customers, Items, and Sales Orders. Ensure that the user has the relevant permissions. Select the "Company" that will be used to create the Sales Orders. Click Save. After saving the Woocommerce Settings, "Secret" and "Endpoint" are generated automatically.
Step 4: From your WooCommerce site's sidebar, go to Settings. Click on the "Advanced" tab, then click on the Webhooks link and then click on the "Add webhook" button. Give the webhook a name of your choice. Click on the "Status" dropdown and select "Active". Select Topic as "Order created". Copy the "Endpoint" from the "WooCommerce Settings" doctype in your ERPNext site and paste it into the "Delivery URL" field. Copy "Secret" from the "WooCommerce Settings" doctype in your ERPNext site and paste it into the "Secret" field. Keep the API VERSION as it is and click on "Save Webhook".
Step 5: From your WooCommerce website, register yourself as a user on the Account page. Now Click on the "Addresses" option and enter the required details. Click on the "Shop" option. You can now see the available products. Add the desired products to the cart and click on "View Cart". From the cart, once you have added the desired products, you can click on "Proceed to Checkout". All billing details and Order details can be seen now. Once you are ok with it, click on the "Place Order" button. An "Order Received" message can be seen indicating that the order has been placed successfully. Now on your ERPNext instance, check the following Document Types: Customer, Address, Item, and Sales Order. They will be fetched and created from the webhook data. In case the orders are not synced, you can check the error in "Home" > "Settings" > "Core" > "Error Log".
After everything has been set up, you will notice that some settings have been configured by default in ERPNext's WooCommerce settings as follows:
- Warehouse: This Warehouse will be used to create Sales Orders. The default Warehouse is "Stores".
- Delivery After (Days): This is the default offset (days) for the Delivery Date in Sales Orders. The default offset is 7 days from the order placement date.
- Sales Order Series: You can set a separate series for Sales Orders created via WooCommerce. The default series is "SO-WOO-".
- UOM: This is the default UOM used for Items and Sales Orders. The default UOM is "Nos".
Congratulations! You have successfully integrated ERPNext with WooCommerce for a fluid E-Commerce workflow.
See Soladrive's managed ERPNext service plans here