The products that a customer purchases from a site’s store are called order items. All order items have an associated order and an associated SKU, which represents the version of the product purchased.

Use the Order Item API to retrieve information about order items from a given order.

Fields

The following table shows all fields that exist for this API and those that are returned when you retrieve a list. All fields are returned when you retrieve a single item.

Name Description Type List
user_id The unique ID of the authenticated user string X
site_id ID of a Weebly site, unique to the currently authenticated user​ string X
discounted_price Price after any discounts have been applied integer X
track_inventory Whether or not the product is configured to keep track of inventory.
Valid values are:
  • true
  • false
boolean X
order_id Unique ID for the order. string X
order_item_id Unique ID (to this order) for the item string X
site_product_id The product ID this order item is associated with. string X
site_product_sku_id The SKU ID this order item is associated with. integer X
name The name of the item, taken from the product. string X
short_description The description for the item, taken from the product. string X
quantity The amount of this item in the order. integer X
product_type The type of this product, taken from the SKU.
Valid values are:
  • physical
  • digital
  • service
string X
download_limit_type The download limit if the SKU associated with this item is a digital good. It can be restricted by either the amount available for download or by a number of days the download is available for. string
download_units_remaining ​The number of downloads available. Either a number of downloads or number of days, based on the download_limit_type. integer
price The full price of this item. integer X
sale_price The sale price of this item. integer X
total_price The total price for all of these items (price * quantity) decimal X
weight Weight of the item. string
weight_unit Unit of measure used by the store for this item.
Valid values are: <
  • lb
  • kg
string
sku ​A user-facing SKU identifier. Typically a code used to identify this SKU. string X
options Option(s) for this order item. For example, the color green, the size medium, or both if it's green and medium. If more than one option is present, and array of option objects is returned. array
returned Whether or not the order item has been returned.
Valid values are:
  • true
  • false
boolean
discounts An array of discount objects. A discount happens when a product is purchased with a sale price or a coupon is used on an order. Discount objects include the following:
  • discount_type with values of: ​
    • markdown: the sale price
    • coupon: a coupon (other than free shipping)
    • shipping: a free shipping coupon
  • discount: the amount saved
  • price: the amount charged
array X
original_product_url URL for the associated product on the published site. array X
created_date Date the order item was created. Unix GMT Timestamp
updated_date Date the order item was last updated. Unix GMT Timestamp

GET
Retrieve a List of Order Items

GET /v1/user/sites/{SITE_ID}/store/orders/{ORDER_ID}/items

Returns all order items for the given order. Only list fields are returned.


scope: read:store-orders

Example CURL request returning all order items:

curl --request GET \
--url https://api.weebly.com/v1/user/sites/987654321/store/orders/123456/items \
--header 'accept: application/vnd.weebly.v1+json' \
--header 'content-type: application/json' \
--header 'x-weebly-access-token: [YOUR_TOKEN]"

Example response:

[
    {
        "user_id": "123456",
        "site_id": "987654321",
        "discounted_price": 8,
        "track_inventory": true,
        "order_id": "123456",
        "order_item_id": "1",
        "site_product_id": "2",
        "site_product_sku_id": "2",
        "name": "T-shirt",
        "short_description": "100% Cotton",
        "quantity": 1,
        "product_type": "physical",
        "price": 10,
        "sale_price": 8,
        "total_price": 8,
        "sku": null,
        "discounts": [
            {
                "discount_type": "markdown",
                "price": 8,
                "discount": 2
            }
        ],
        "original_product_url": "http://mystore.weebly.com/store/p2/tshirt.html"
    },
    {
        "user_id": "123456",
        "site_id": "987654321",
        "discounted_price": 0,
        "track_inventory": true,
        "order_id": "123456",
        "order_item_id": "2",
        "site_product_id": "1",
        "site_product_sku_id": "1",
        "name": "Sticker",
        "short_description": "Iron on sticker",
        "quantity": 1,
        "product_type": "physical",
        "price": 1,
        "sale_price": null,
        "total_price": 1,
        "sku": " ghjktyu t",
        "discounts": [],
        "original_product_url": "http://mystore.weebly.com/store/p1/sticker.html"
    }
]

GET
Retrieve the Number of Order Items for an Order

GET /v1/user/sites/{SITE_ID}/store/orders/{ORDER_ID}/items/count

Returns the number of non-deleted orders.


scope: read:store-orders

Example CURL request:

curl --request GET \
--url https://api.weebly.com/v1/user/sites/987654321/store/orders/123456/items/count \
--header 'accept: application/vnd.weebly.v1+json' \
--header 'content-type: application/json' \
--header 'x-weebly-access-token: [YOUR_TOKEN]"

Example response:

{
    "count": 2
}

GET
Retrieve Details for an Order Item

GET /v1/user/sites/{SITE_ID}/store/orders/{ORDER_ID}/items/{ORDER_ITEM_ID}

Returns all fields for the given order item.


scope: read:store-orders

Example CURL request:

curl --request GET \
--url https://api.weebly.com/v1/user/sites/987654321/store/orders/123456/items/1 \ \
--header 'accept: application/vnd.weebly.v1+json' \
--header 'content-type: application/json' \
--header 'x-weebly-access-token: [YOUR_TOKEN]"

Example response:

See Fields table. All fields for the order item are returned.

{
    "user_id": "123456",
    "site_id": "987654321",
    "discounted_price": 8,
    "track_inventory": true,
    "order_id": "123456",
    "order_item_id": "1",
    "site_product_id": "2",
    "site_product_sku_id": "2",
    "name": "T-shirt",
    "short_description": "100% Cotton",
    "quantity": 1,
    "product_type": "physical",
    "download_limit_type": null,
    "download_units_remaining": null,
    "price": 10,
    "sale_price": 8,
    "total_price": 8,
    "weight": 1,
    "weight_unit": "lb",
    "sku": null,
    "options": {
        "Color": "red",
        "Size": "small"
    },
    "returned": null,
    "discounts": [
        {
            "discount_type": "markdown",
            "price": 8,
            "discount": 2
        }
    ],
    "original_product_url": "http://mystore.weebly.com/store/p2/tshirt.html",
    "created_date": 1442892536,
    "updated_date": 1442892536
}

Help make these docs better!









Tags: