Skip to main content
Custom Embed Line Items Ingest

Ingesting cart contents into KnoCommerce for custom integration stores

Landon Anspach avatar
Written by Landon Anspach
Updated over a week ago

As a Custom Integration store, you may want to pass cart contents information into KnoCommerce to utilize specific features like Product-specific Audiences. In conjunction with our Universal Embed help doc, this help doc will elaborate on how to add the line_items ingest to your custom integration script.



Location in Script

The attribute line_items will be included in the order object within the window.Kno script definitions. This is the starting point for how to add line_items to the existing order object in the Kno script for your store.

order: {
line_items: []
}

Line_items Format & Content

The line_items attribute needs to be passed as an array of objects (each one corresponding to a product in the cart). It needs to be formatted and will look something like the following:

[
{
sku: "KNO-TestProd1",
name: "KnoCommerce T-Shirt - Black - Medium",
price: 12.99,
title: "KnoCommerce Branded Cotton T-Shirt",
vendor: "KnoCommerce",
gift_card: false,
product_id: "0121012101210",
variant_id: "9878987898789",
variant_title: "Black - Medium",
total_discount: 0,
requires_shipping: true
},
{
sku: "KNO-TestProd9",
name: "KnoCommerce Coffee Mug - Lime/Black Branded",
price: 10.99,
title: "KnoCommerce Branded Coffee Mug",
vendor: "KnoCommerce",
gift_card: false,
product_id: "23454323454323",
variant_id: "76567656765676",
variant_title: "Lime/Black Branded",
total_discount: 0,
requires_shipping: true
}
]

Syntax

Each object can accept the following attributes (also included are required data types). None of the attributes themselves are required, so you can choose which ones are helpful vs. not helpful.

  • sku - (string) - SKU of the product

  • name - (string) - the combination of title & variant_title for full product description (i.e. KnoCommerce T-Shirt - Medium - Black)

  • price (number) - price in full currency units of the product

  • title - (string) - label/descriptor of the product grouping (i.e. Sunbrella® Crosshatch Indoor Outdoor Throw)

  • vendor - (string) - the selling vendor if you have multiple running through your site

  • gift_card - (boolean) - is the product itself a gift_card

  • product_id - (string) - unique to product grouping (if the store has variants) or specific product (if no variants)

  • variant_id - (string) - unique to a particular variant, differentiates between variants with the same product_id

  • variant_title - (string) - label/descriptor of the specific variant (i.e. Flax, Lake, Latte, Smoke, etc.)

  • total_discount - (number) - portion of cart discount applied to this specific product

  • requires_shipping - (boolean) - does the product itself require shipping to the customer or not


Use Case

Most important uses within the Kno platform that utilize information from line_items are the following:

  • Audiences are built using the order.line_items.product_id attribute within the line_items object

  • CSV Exports include a field that is populated using the name attribute

Did this answer your question?