WooCommerce

 

WooCommerce is an open-source e-commerce plugin for WordPress. It is designed for small to large-sized online merchants using WordPress. The plugin quickly became popular for its simplicity to install and customize and for the market position of the base product as freeware.

Woocommerce is now one of the leading options for online stores and for people who want to open there store online and fufill orders from it.

 

UChat supports WooCommerce integration natively along with all the actions the current WooCommerce api supports in its endpoints.

 

You can not only create automations using UChat for your WooCommerce store but also be able to create, edit, update orders, fullfill them, keep track of the orders, shipments , reviews etc.

Integrating Your WooCommerce Store With UChat

In order to integrate Uchat with your WooCommerce store, you need to log in to your store and click on WooCommerce Tab.

 

 

 

Click on Settings > Advanced > REST API tab

 

 

Click on Add Key

 

Enter the details and create your API Key.

 

 

Save and copy the details.

 

 

 

On UChat, Click on Integrations tab and click on WooCommerce to integrate your store.

 

 

Using WooCommerce Actions

To use WooCommerce actions, create an action node and then click on integrations to find WooCommerce tab and click on it.

 

WooCommerce Native Actions

 

WooCommerce supports the following actions from their API endpoints as follows.

 

We will now explore each on of them in detail.

 

Add To Cart

This action is used to add an item or product to the user’s cart.

 

 

Following response payload is received

 

{
"variant_id": 4120,
"product_id": 375,
"quantity": 1,
"previous_quantity": 0
}

 

 

Remove Cart By Variant

This action is used to remove an item or product from cart using its variant and product ID.

 

 

Following response payload is received.

 

{
"variant_id": 4120,
"product_id": 375,
"quantity": 1,
"previous_quantity": 3
}

 

 

Remove Cart By Product

This action is used to remove an item or product from cart using product ID only.

 

 

Following response payload is received.

 

{
"product_id": 375,
"removed_variants": [
{
"variant_id": 4120,
"quantity": 1
}
]
}

 

 

Empty Cart

This action is used to empty the complete cart.

 

 

Following response payload is received.

 

{
"status": "ok"
}

 

 

Get Cart Items

This action is used to fetch all the details for items present in the cart

 

 

Following response payload is received.

 

[
{
"id": 258,
"name": "DNK Black Shoes - blue",
"product_id": 375,
"variation_id": 4120,
"quantity": 2,
"subtotal": "350.00",
"subtotal_tax": "0.00",
"total": "350.00",
"total_tax": "0.00",
"sku": "",
"price": 175,
"image": "https://shop.businessautomated.io/wp-content/uploads/2021/03/sports-shoe5.jpg",
"parent_name": "DNK Black Shoes"
}
]

 

Get Cart Item IDs and Quantity

This action is used to get item’s IDs and quantity which are present in the cart.

 

 

Following response payload is received.

 

[
{
"product_id": 375,
"quantity": 2,
"variation_id": 4120
}
]

 

Create Order From Cart

This action is used to create an order using cart items.

 

 

Following response payload is received.

 

{
"id": 4597,
"parent_id": 0,
"status": "pending",
"currency": "AUD",
"version": "6.9.4",
"prices_include_tax": false,
"date_created": "2023-04-14T11:01:51",
"date_modified": "2023-04-14T11:01:51",
"discount_total": "0.00",
"discount_tax": "0.00",
"shipping_total": "0.00",
"shipping_tax": "0.00",
"cart_tax": "0.00",
"total": "350.00",
"total_tax": "0.00",
"customer_id": 0,
"order_key": "wc_order_5hKQmDkxUiesi",
"billing": {
"first_name": "Hammad",
"last_name": "Siddiqui",
"company": "",
"address_1": "ABC Road, Garden City",
"address_2": "",
"city": "Karachi",
"state": "Sindh",
"postcode": "",
"country": "Pakistan",
"email": "hammadsiddiqui788@gmail.com",
"phone": "+9230302320964"
},
"shipping": {
"first_name": "Hammad",
"last_name": "Siddiqui",
"company": "",
"address_1": "ABC Road, Garden City",
"address_2": "",
"city": "Karachi",
"state": "Sindh",
"postcode": "",
"country": "Pakistan",
"phone": ""
},
"payment_method": "",
"payment_method_title": "",
"transaction_id": "",
"customer_ip_address": "",
"customer_user_agent": "",
"created_via": "rest-api",
"customer_note": "",
"date_completed": null,
"date_paid": null,
"cart_hash": "",
"number": "4597",
"meta_data": [
{
"id": 6465,
"key": "user_ns",
"value": "f12372u15376836"
}
],
"line_items": [
{
"id": 259,
"name": "DNK Black Shoes - blue",
"product_id": 375,
"variation_id": 4120,
"quantity": 2,
"tax_class": "",
"subtotal": "350.00",
"subtotal_tax": "0.00",
"total": "350.00",
"total_tax": "0.00",
"taxes": [...], // 0 items
"meta_data": [...], // 1 items
"sku": "",
"price": 175,
"image": {...}, // 2 keys
"parent_name": "DNK Black Shoes"
}
],
"tax_lines": [
],
"shipping_lines": [
],
"fee_lines": [
],
"coupon_lines": [
],
"refunds": [
],
"payment_url": "https://shop.businessautomated.io/checkout-2/order-pay/4597?pay_for_order=true&key=wc_order_5hKQmDkxUiesi",
"is_editable": true,
"needs_payment": true,
"needs_processing": true,
"date_created_gmt": "2023-04-14T11:01:51",
"date_modified_gmt": "2023-04-14T11:01:51",
"date_completed_gmt": null,
"date_paid_gmt": null,
"currency_symbol": "$"
}

 

Search For Coupons

This action is used to search for coupons available on your woocommerce store on various search parameters and queries.

 

 

Following response payload is received.

[
{
"id": 4592,
"code": "vipdiscount60fc",
"amount": "10.00",
"status": "publish",
"date_created": "2023-01-25T06:56:57",
"date_created_gmt": "2023-01-25T06:56:57",
"date_modified": "2023-01-25T06:56:57",
"date_modified_gmt": "2023-01-25T06:56:57",
"discount_type": "percent",
"description": "10% discount on entire order, single use",
"date_expires": null,
"date_expires_gmt": null,
"usage_count": 1,
"individual_use": false,
"product_ids": [
],
"excluded_product_ids": [
],
"usage_limit": 1,
"usage_limit_per_user": 1,
"limit_usage_to_x_items": null,
"free_shipping": false,
"product_categories": [
],
"excluded_product_categories": [
],
"exclude_sale_items": false,
"minimum_amount": "0.00",
"maximum_amount": "0.00",
"email_restrictions": [
],
"used_by": [
"mark@doe.com"
],
"meta_data": [
],
"_links": {
"self": [...], // 1 items
"collection": [...] // 1 items
}
}
]

 

Get Coupon Info

This action is used to fetch a particular coupon’s info using its coupon ID.

 

 

Following response payload is received.

 

{
"id": 4592,
"code": "vipdiscount60fc",
"amount": "10.00",
"status": "publish",
"date_created": "2023-01-25T06:56:57",
"date_created_gmt": "2023-01-25T06:56:57",
"date_modified": "2023-01-25T06:56:57",
"date_modified_gmt": "2023-01-25T06:56:57",
"discount_type": "percent",
"description": "10% discount on entire order, single use",
"date_expires": null,
"date_expires_gmt": null,
"usage_count": 1,
"individual_use": false,
"product_ids": [
],
"excluded_product_ids": [
],
"usage_limit": 1,
"usage_limit_per_user": 1,
"limit_usage_to_x_items": null,
"free_shipping": false,
"product_categories": [
],
"excluded_product_categories": [
],
"exclude_sale_items": false,
"minimum_amount": "0.00",
"maximum_amount": "0.00",
"email_restrictions": [
],
"used_by": [
"mark@doe.com"
],
"meta_data": [
]
}

 

Delete Coupon

This action is used to delete a coupon based on its coupon ID.

 

 

Following response payload is received.

 

{
"status": "ok"
}

 

Create Coupon

This action is used to create a coupon.

 

 

Following response payload is received.

 

{
"id": 4598,
"code": "test12",
"amount": "10.00",
"status": "publish",
"date_created": "2023-04-14T14:27:49",
"date_created_gmt": "2023-04-14T14:27:49",
"date_modified": "2023-04-14T14:27:49",
"date_modified_gmt": "2023-04-14T14:27:49",
"discount_type": "percent",
"description": "test coupon",
"date_expires": "2023-05-01T00:00:00",
"date_expires_gmt": "2023-05-01T00:00:00",
"usage_count": 0,
"individual_use": false,
"product_ids": [
],
"excluded_product_ids": [
],
"usage_limit": 1,
"usage_limit_per_user": 1,
"limit_usage_to_x_items": null,
"free_shipping": false,
"product_categories": [
],
"excluded_product_categories": [
],
"exclude_sale_items": false,
"minimum_amount": "0.00",
"maximum_amount": "0.00",
"email_restrictions": [
],
"used_by": [
],
"meta_data": [
]
}

 

Update Coupon

This action is used to update a coupon using its coupon ID.

 

 

Following response payload is received.

 

{
"id": 4598,
"code": "test12",
"amount": "15.00",
"status": "publish",
"date_created": "2023-04-14T14:27:49",
"date_created_gmt": "2023-04-14T14:27:49",
"date_modified": "2023-04-14T14:27:49",
"date_modified_gmt": "2023-04-14T14:27:49",
"discount_type": "percent",
"description": "test coupon",
"date_expires": "2023-05-01T00:00:00",
"date_expires_gmt": "2023-05-01T00:00:00",
"usage_count": 0,
"individual_use": false,
"product_ids": [
],
"excluded_product_ids": [
],
"usage_limit": 3,
"usage_limit_per_user": 1,
"limit_usage_to_x_items": null,
"free_shipping": false,
"product_categories": [
],
"excluded_product_categories": [
],
"exclude_sale_items": false,
"minimum_amount": "0.00",
"maximum_amount": "0.00",
"email_restrictions": [
],
"used_by": [
],
"meta_data": [
]
}

 

Search For Customers

This action is used to search for customers using various parameters and queries.

 

 

Following response payload was received.

 

[
{
"id": 2,
"date_created": "2022-10-10T01:24:22",
"date_created_gmt": "2022-10-10T01:24:22",
"date_modified": "2022-10-10T01:24:22",
"date_modified_gmt": "2022-10-10T01:24:22",
"email": "test@test.com",
"first_name": "",
"last_name": "last",
"role": "customer",
"username": "test",
"billing": {
"first_name": "",
"last_name": "",
"company": "",
"address_1": "",
"address_2": "",
"city": "",
"postcode": "",
"country": "",
"state": "",
"email": "",
"phone": ""
},
"shipping": {
"first_name": "",
"last_name": "",
"company": "",
"address_1": "",
"address_2": "",
"city": "",
"postcode": "",
"country": "",
"state": "",
"phone": ""
},
"is_paying_customer": false,
"avatar_url": "https://secure.gravatar.com/avatar/b642b4217b34b1e8d3bd915fc65c4452?s=96&d=mm&r=g",
"meta_data": [
{...} // 3 keys
],
"_links": {
"self": [...], // 1 items
"collection": [...] // 1 items
}
},
{
"id": 5,
"date_created": "2022-10-12T16:32:26",
"date_created_gmt": "2022-10-12T16:32:26",
"date_modified": "2022-10-12T16:32:26",
"date_modified_gmt": "2022-10-12T16:32:26",
"email": "mark@uchat.com.au",
"first_name": "Mark",
"last_name": "van der Made",
"role": "customer",
"username": "markvdmade",
"billing": {
"first_name": "Mark",
"last_name": "van der Made",
"company":