Add one or more items to the shopping cart.
If no cart exists, this tool makes a new cart. This tool adds products and gift
certificates.
Steps
1. Call the 'search_products' tool to find a product.
2. Call the 'get_product_details' tool to get the variants and the modifier options.
3. Call this tool to add the item.
4. Call the 'create_checkout_url' tool to get a checkout URL.
Rules
Send 'quantity' and 'productEntityId' for each item.
If the product has variants, send 'variantEntityId'.
Modifier options
A modifier option is a product choice that is not a variant.
Examples are an engraving message and a nicotine strength.
The 'get_product_details' tool returns these options in 'modifierOptions'.
If the product has no 'modifierOptions', do not send 'selectedOptions'.
Do not send a variant option in 'selectedOptions'.
Send a variant in 'variantEntityId'.
An option is required if 'isRequired' is 'true'.
Send each required option.
If you do not send a required option, the server does not add the item.
To send an option:
1. Read the bucket name from 'selectedOptionsKey'.
2. Add the option to 'item.selectedOptions' in that bucket.
3. Send the 'optionEntityId' of the option.
4. For a choice option, send the 'valueEntityId' of the value that the user selected.
Send only the buckets that you need.
Example. A required choice option has a 'selectedOptionsKey' of "multipleChoices", an
'optionEntityId' of 108, and a selected value with a 'valueEntityId' of 251:
{
"item": {
"quantity": 1,
"productEntityId": 88,
"variantEntityId": 67,
"selectedOptions": {
"multipleChoices": [ { "optionEntityId": 108, "optionValueEntityId": 251 } ]
}
}
}
A free-entry bucket takes a typed value in place of an ID.
'textFields' and 'multiLineTextFields' take "text".
'numberFields' takes "number".
'dateFields' takes "date".
Obey the 'constraints' of the option.
If a required option has more than one value, ask the user to se
输入参数item必填
CreateResult a checkout URL for a cart assigned to a current session
Arguments:
None, but requires a cart to be present in the current session.
Returns:
- checkoutURL - the URL to redirect the user to for checkout
- errors - any errors encountered during the process (like, cart not found, etc.)
Flow:
- Call 'manage_cart' with 'create_cart' operation to create a new cart.
- Call this tool to create a checkout URL for the cart assigned to the current session.
无需输入参数。
Get the details of one or more products. The details are the variants, the options, and
the images.
Arguments
productIds - The list of product IDs. Get these IDs from the 'search_products' tool.
Request only the products that the user needs.
The server has a maximum count of IDs. The default maximum is 20.
If you send too many IDs, the server returns an error. Then send fewer IDs.
option_values - The option IDs and the value IDs of one variant.
Use this argument with one product ID only. This argument applies to the B2C catalog.
For a B2B buyer, the tool returns all the variants. Then select one variant.
channelId - Optional. This argument selects the B2B catalog.
The default is the channel of the request.
variantCursor - Optional. This argument gets the next page of variants.
Use this argument with one product ID only.
Take the value from 'nextVariantCursor' in the previous result.
If 'nextVariantCursor' is absent, or is null, or is the text "null", do not send this
argument.
Results
The tool returns a list of products in 'products'. The output schema gives all the
fields.
A product has 'modifierOptions' only if the product has modifier options.
A variant has a price, an inventory level, a purchase flag, and bulk prices only for a
B2B buyer.
If the tool does not find a product, the list does not include that product.
Modifier options
A modifier option is a product choice that is not a variant.
Examples are an engraving message and a gift note.
A variant option is never a modifier option.
If a product has no 'modifierOptions', add the product to the cart without
'selectedOptions'.
An option is required if 'isRequired' is 'true'.
Send each required option to the 'add_item_to_cart' tool.
If you do not send a required option, the server does not add the item.
A variant selection does not replace a required option.
Each option has 'optionEntityId', 'displayName', and 'selectedOptionsKey'.
'selectedOptionsKey' is the name of the field to send
输入参数channelIdproductIds必填option_valuesvariantCursor
Remove specific items from your shopping cart.
It is removing the item completly from the cart.
If you want to reduce quantity of the items use 'update_cart_item'
Remove unwanted items from your shopping cart by targeting specific item IDs. This tool provides precise control over cart cleanup and item removal.
Use this tool when customers want to:
-Remove specific products they no longer want
-Delete gift certificates from their cart
-Clean up their cart before checkout
-Remove items added by mistake
Features:
- Target removal by specific item ID
- Works with both products and gift certificates
- Maintains cart structure after removal
- Immediate cart updates
Flow:
- Call 'search_products' tool to find products by search term.
- Call 'get_product_details' tool to get product variants and images.
- Call 'add_item_to_cart' tool to create new cart with item
- Call 'add_item_to_cart' tool to add another item to cart
- Call 'remove_item_from_cart' tool to remove added item to cart
- Call 'create_checkout_url' tool to generate a checkout URL for the cart.
Requires an existing cart with items to remove.
输入参数item_id必填
Search products by a term
Arguments:
term - the search term to look for products. It should be at least 3 characters long.
cursor - optional, used for pagination. If provided, it will return the next page of results after.
Pagination:
Supports pagination with 'cursor' arguments. If 'cursor' is not provided, it will return the first page of results.
Value for 'cursor' can be obtained from the 'nextCursor' field in the response. If 'nextCursor' is null, it means there are no more results to fetch.
If value of cursor is null (or a string representation of 'null') dont send it in the payload.
Results:
Each product includes 'requiresFileUpload'. When true, the product has a required file-upload
option (e.g. "upload your design") and shouldn't be added to cart through this assistant. Do not
attempt to purchase it — tell the user it must be ordered on the website.
Stock:
Each product carries 'inStock'. It reports whether the store has units on hand. It does NOT
report whether the item can be bought.
- false does NOT mean the purchase will fail. Many stores accept orders for out-of-stock
items - backorder, pre-order, or made-to-order goods that are fabricated after ordering.
Whether a given store does is not exposed by this API.
So: tell the user the item is out of stock and may take longer to arrive, then ADD IT if
they still want it. Do not refuse on 'inStock: false' alone.
- If the store really does block it, 'add_item_to_cart' fails and returns the reason. Relay
that reason to the user. Attempting the add is the only reliable way to find out.
- true only means no out-of-stock condition is reported. A store that does not track inventory
reports true for every product, so never state or imply a quantity.
- 'inventoryLevel' appears only on stores that publish stock figures; absent means undisclosed,
not zero.
Flow:
- Call this tool with a 'term' argument and optionally with 'cursor' to search for products.
- if you find a matching product, call 'get_pro
输入参数term必填cursorcontext
Change an item that is already in the shopping cart.
Use this tool to change the quantity, the variant, or the modifier options of one cart
item. A cart must exist and must have items.
Steps
1. Call the 'add_item_to_cart' tool to put an item in the cart.
2. Call this tool to change the item.
3. Call the 'create_checkout_url' tool to get a checkout URL.
Rules
Send 'line_item_id' to select the cart item to change.
Send 'quantity' and 'productEntityId' in 'item'.
If the product has variants, send 'variantEntityId'.
Modifier options
'item.selectedOptions' works as it works in the 'add_item_to_cart' tool.
The 'get_product_details' tool returns these options in 'modifierOptions'.
If the product has required modifier options, send them again in this request.
If you do not send them, the server does not change the item.
Send only the buckets that you need.
输入参数item必填line_item_id必填