Recently viewed products, product recommendations and products from a collection.
Product data for your own storefront sections: what the customer viewed recently, products picked by your product recommendation rules, and products from a collection. Product and variant IDs are Shopify's numeric IDs as strings, such as "7982301462638".
getRecentlyViewedProductsLists the products the customer viewed recently, newest first.addRecentlyViewedProductRecords that the customer viewed a product.getRecommendedProductsLists the products a product recommendation rule picks for the customer.getCollectionProductsReturns up to 10 products from a collection, picked at random each time.Lists the products the customer viewed recently, newest first.
Toki records a view each time the customer opens a product page in your store. A guest's views are kept in the browser, up to the 50 most recent. A signed-in customer's views are saved to their account, so they follow the customer from device to device, and are combined with the views from this browser. Prices follow the customer's current country and currency.
itemsRecentlyViewedProduct[]idstringProduct ID.
titlestringhandlestringurlstringPath of the product page, such as /products/linen-shirt.
imagestringImage URL.
pricenumber | nullLowest variant price in cents, such as 4999 for $49.99, or null when the price isn't available. Show display_price to the customer.
display_pricestring | nullprice in your store's currency format, such as "$49.99".
currencyCodestring | nullOptionalCurrency of price, such as "USD".
viewed_atstringWhen the customer last viewed the product, as an ISO 8601 date-time.
Records that the customer viewed a product.
Toki records a view on its own each time a product page loads in your store. Call this when the customer sees a product in another way, such as in a quick view. You can pass the product object from Shopify's Ajax Product API as it is.
For a guest, the view is saved in the browser; for a signed-in customer, it's saved to their account. Viewing a product again moves it to the top of the list.
productRecentlyViewedProductInputRequiredidstring | numberRequiredProduct ID.
titlestringRequiredhandlestringRequiredurlstringRequiredPath of the product page, such as /products/linen-shirt.
featured_imagestringRequiredImage URL.
pricenumberRequiredLowest variant price in cents, in the currency the customer is shopping in, such as 4999 for $49.99.
Nothing, once it's done.
Lists the products a product recommendation rule picks for the customer.
ruleId is the ID of an active product recommendation rule: the rule's id in the Manage API.
Toki runs the rule's strategies in order and joins their products without duplicates, shuffled if the rule is set to randomize. For a signed-in customer with past orders, co-purchase strategies start from what they bought. Prices are in your store's default currency, such as 49.99. Rejects when no active rule has this ID.
ruleIdstringRequiredProduct recommendation rule ID.
productsRecommendedProduct[]idstringProduct ID.
labelstringProduct title.
imageUrlstring | nullImage URL.
minPricenumberLowest variant price.
maxPricenumberHighest variant price.
variantsRecommendedProductVariant[]idstringVariant ID.
titlestringVariant title, or the product title for a product with a single variant.
pricenumberimageUrlstring | nullImage URL.
Returns up to 10 products from a collection, picked at random each time.
collectionId is the collection's numeric ID, such as "412093284590". Toki picks from the collection's products that are published to your online store and available for sale, and products you add to the collection show up within an hour. Prices are decimal strings in your store's default currency, such as "49.99". Resolves an empty list when no collection has this ID.
collectionIdstringRequiredCollection ID.
productsCollectionProduct[]idstringProduct ID.
handlestringurlstringProduct page URL, such as https://acme.com/products/linen-shirt.
titlestring | nullimagestring | nullFeatured image URL.
minPricestring | nullLowest variant price.
maxPricestring | nullHighest variant price.
variantsCollectionProductVariant[]Up to 10 variants that are available for sale.
idstringVariant ID.
titlestring"Default Title" for a product with a single variant.
pricestring | null