Merge branch 'docs/woocommerce'

This commit is contained in:
Tanay Pant 2021-01-04 10:06:51 +01:00
commit baf841aab3
11 changed files with 168 additions and 7 deletions

View File

@ -11,13 +11,18 @@ You can use these credentials to authenticate the following nodes with WooCommer
## Prerequisites
Create a [WooCommerce](https://woocommerce.com/) account.
Install the [WooCommerce](https://woocommerce.com/) plugin on your WordPress website.
## Using Access Token
1. Access your WooCommerce dashboard.
2. Go to Settings, advanced and then REST API.
3. Click Add Key.
4. Enter necessary details.
5. Once key is granted, you will receive a consumer key & secret.
6. Use your Woocommerce URL, consumer key & secret with your n8n credentials.
1. Access your WordPress dashboard.
2. Select 'Settings' from the ***WooCommerce*** dropdown list.
3. Click on the ***Advanced*** tab.
4. Click on ***REST API***.
5. Click on the ***Create an API Key*** button.
6. Enter the necessary details.
7. Select 'Read/Write' from the ***Permissions*** dropdown list.
8. Click on the ***Generate API Key*** button.
9. Use your WooCommerce website URL, Consumer key & Consumer secret with your WooCommerce node credentials in n8n.
![Getting WooCommerce credentials](./using-access-token.gif)

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 MiB

View File

@ -0,0 +1,90 @@
---
permalink: /nodes/n8n-nodes-base.wooCommerce
description: Learn how to use the WooCommerce node in n8n
---
# WooCommerce
[WooCommerce](https://woocommerce.com/) is a customizable, open-source e-commerce plugin for WordPress.
::: tip 🔑 Credentials
You can find authentication information for this node [here](../../../credentials/WooCommerce/README.md).
:::
## Basic Operations
::: details Order
- Create a order
- Delete a order
- Get a order
- Get all orders
- Update a order
:::
::: details Product
- Create a product
- Delete a product
- Get a product
- Get all products
- Update a product
:::
## Example Usage
This workflow allows you to create, update, and get a product from WooCommerce. You can also find the [workflow](https://n8n.io/workflows/847) on n8n.io. This example usage workflow uses the following nodes.
- [Start](../../core-nodes/Start/README.md)
- [WooCommerce]()
The final workflow should look like the following image.
![A workflow with the WooCommerce node](./workflow.png)
### 1. Start node
The start node exists by default when you create a new workflow.
### 2. WooCommerce node (create: product)
This node will create a new product in WooCommerce.
1. First of all, you'll have to enter credentials for the WooCommerce node. You can find out how to do that [here](../../../credentials/WooCommerce/README.md).
2. Enter the product name in the ***Name*** field.
3. Click on ***Add Field*** and select 'Description'.
4. Enter a description in the ***Description*** field.
5. Click on ***Add Field*** and select 'Regular Price'.
6. Enter the price in the ***Regular Price*** field.
7. Click on ***Execute Node*** to run the node.
In the screenshot below, you will notice that the node creates a new product.
![Using the WooCommerce node to create a new product](./WooCommerce_node.png)
### 3. WooCommerce1 node (update: product)
This node will update the product that we created in the previous node. We will update the quantity of the product.
::: v-pre
1. Select the credentials that you entered in the previous node.
2. Select 'Update' from the ***Operation*** dropdown list.
3. Click on the gears icon next to the ***Product ID*** field and click on ***Add Expression***.
4. Select the following in the ***Variable Selector*** section: Nodes > WooCommerce > Output Data > JSON > id. You can also add the following expression: `{{$node["WooCommerce"].json["id"]}}`.
5. Click on ***Add Field*** and select 'Stock Quantity'.
6. Set the quantity in the ***Stock Quantity*** field.
7. Click on ***Execute Node*** to run the node.
:::
In the screenshot below, you will notice that the node updates the quantity of the product that we created in the previous node.
![Using the WooCommerce node to update the quantity of a product](./WooCommerce1_node.png)
### 4. WooCommerce2 node (get: product)
This node will get the information about the product that we created using the WooCommerce node.
:::v-pre
1. Select the credentials that you entered in the previous node.
2. Select 'Update' from the ***Operation*** dropdown list.
3. Click on the gears icon next to the ***Product ID*** field and click on ***Add Expression***.
4. Select the following in the ***Variable Selector*** section: Nodes > WooCommerce > Output Data > JSON > id. You can also add the following expression: `{{$node["WooCommerce"].json["id"]}}`.
5. Click on ***Execute Node*** to run the node.
In the screenshot below, you will notice that the node returns the information about the product that we created using the WooCommerce node.
![Using the WooCommerce node to get the information of a product](./WooCommerce2_node.png)

Binary file not shown.

After

Width:  |  Height:  |  Size: 161 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 168 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 154 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 166 KiB

View File

@ -0,0 +1,66 @@
---
permalink: /nodes/n8n-nodes-base.wooCommerceTrigger
description: Learn how to use the WooCommerce Trigger node in n8n
---
# WooCommerce Trigger
[WooCommerce](https://woocommerce.com/) is a customizable, open-source e-commerce plugin for WordPress.
::: tip 🔑 Credentials
You can find authentication information for this node [here](../../../credentials/WooCommerce/README.md).
:::
## Events
- coupon.created
- coupon.updated
- coupon.deleted
- customer.created
- customer.updated
- customer.deleted
- order.created
- order.updated
- order.deleted
- product.created
- product.updated
- product.deleted
## Example Usage
This workflow allows you to send a message on Mattermost when an order is created in WooCommerce. You can also find the [workflow](https://n8n.io/workflows/848) on n8n.io. This example usage workflow would use the following nodes.
- [WooCommerce Trigger]()
- [Mattermost](../../nodes/Mattermost/README.md)
The final workflow should look like the following image.
![A workflow with the WooCommerce Trigger node](./workflow.png)
### 1. WooCommerce Trigger node
This node will trigger the workflow when an order is created in your WooCommerce store.
1. First of all, you'll have to enter credentials for the WooCommerce Trigger node. You can find out how to do that [here](../../../credentials/WooCommerce/README.md).
2. Select 'order.created' from the ***Event*** dropdown list. This will trigger the workflow when a user sends a message.
3. Click on ***Execute Node*** to run the node.
In the screenshot below, you will notice that the node triggers the workflow when a new order gets created.
![Using the WooCommerce Trigger node to trigger the workflow](./WooCommerceTrigger_node.png)
### 2. Mattermost (post: message)
This node will send a message to a Mattermost channel sharing the details of the order that was created in WooCommerce.
1. First of all, you'll have to enter credentials for the Mattermost node. You can find out how to do that [here](../../../credentials/Mattermost/README.md).
2. Select the channel from the ***Channel ID*** dropdown list.
3. Click on the gears icon next to ***Message*** field.
4. Enter the following message in the ***Expression*** editor
```
{{$node["WooCommerce Trigger"].json["billing"]["first_name"]}} bought {{$node["WooCommerce Trigger"].json["line_items"][0]["name"]}}!
```
5. Click on ***Execute Node*** to run the node.
In the screenshot below, you will notice that the node sends a message to the `Sales` channel on Mattermost about the order that was created in WooCommerce.
![Using the Mattermost node to send the information of the order to a channel](./Mattermost_node.png)

Binary file not shown.

After

Width:  |  Height:  |  Size: 121 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 KiB