Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

In this section, we will talk about the “Ecommerce” related actions. UChat support below customer related actions:

  • Get Shop Information

  • Lookup discount code

  • Create discount code

  • Search for draft orders

  • Create draft orders for one product

  • Create draft order for multiple products

  • Create draft order with custom products

  • Send an invoice for the draft order

  • Apply discount to draft order

  • Complete draft order

  • Get draft order information

  • Get order information

Now, let’s go over these actions one by one.

Table of Contents

Add To Cart

This action is used to add a product to a user’s cart using bot user’s NS and variant id of the product.

 

Input

...

 

Response Payload

{
"variant_id": 12535571218498,
"product_id": 1413101355074,
"quantity": 2,
"previous_quantity": 1
}

 

 

Remove From Cart

This action is used to remove an item from the cart using user NS and variant Id.

 

Input

...

 

Response Payload

{
"variant_id": 12535571218498,
"product_id": 1413101355074,
"quantity": 1,
"previous_quantity": 2
}

 

 

Empty Cart

This action is used to completely empty a cart for a user using their user NS

 

Input

...

 

Response Payload

{
"status": "ok"
}

 

 

Get Cart Items

This action is used to fetch cart information of a bot user , using their user NS

 

Input

...

 

Response Payload

{
"note": "f12372u15376836",
"taxes_included": false,
"currency": "AUD",
"tax_exempt": false,
"name": "#D131",
"line_items": [
{
"id": 57423008071746,
"variant_id": 12535571218498,
"product_id": 1413101355074,
"title": "2 in 1 Gold MacBook Riser & Stand",
"variant_title": "silver",
"sku": "9877410-silver",
"vendor": "hapans",
"quantity": 3,
"requires_shipping": true,
"taxable": false,
"gift_card": false,
"fulfillment_service": "manual",
"grams": 0,
"tax_lines": [...], // 0 items
"applied_discount": null,
"name": "2 in 1 Gold MacBook Riser & Stand - silver",
"properties": [...], // 0 items
"custom": false,
"price": "47.99",
"admin_graphql_api_id": "gid://shopify/DraftOrderLineItem/57423008071746"
}
],
"tax_lines": [
],
"total_price": "143.97",
"subtotal_price": "143.97",
"total_tax": "0.00"
}

 

 

Create Draft Order From Cart

This action is used to create a draft order using line items available in the cart.

 

Input

...

 

Response Payload

{
"draft_order": {
"id": 932223320130,
"note": "f12372u15376836",
"email": null,
"taxes_included": false,
"currency": "AUD",
"invoice_sent_at": null,
"created_at": "2023-04-07T05:13:45-04:00",
"updated_at": "2023-04-07T05:13:45-04:00",
"tax_exempt": false,
"completed_at": null,
"name": "#D132",
"status": "open",
"line_items": [
{...} // 20 keys
],
"shipping_address": null,
"billing_address": null,
"invoice_url": "https://connectdots-demo-store.myshopify.com/1763672130/invoices/c79c6b0ed4125ded500ed427a00e2009 ",
"applied_discount": null,
"order_id": null,
"shipping_line": null,
"tax_lines": [
],
"tags": "",
"note_attributes": [
],
"total_price": "143.97",
"subtotal_price": "143.97",
"total_tax": "0.00",
"payment_terms": null,
"admin_graphql_api_id": "gid://shopify/DraftOrder/932223320130"
}
}