API Reference
Product variant of a deal to be added to cart. Used by
Deal.addVariantsToCart()
.Kind: global class
The position of the product this variant belongs to inside the deal
Variant ID
Variant quantity
Kind: global class
Image height in pixels, can be null if unknown.
Image width in pixels, can be null if unknown.
Image URL, similar to the src property of the
img
tag.Image alt value, similar to the alt property of the
img
tag.The position of this image inside the list of product images. Null if not applicable. Note: positions are 1-based.
Kind: global class
Option ID on Shopify. Unique across all option objects on Shopify.
Option name, e.g.
Color
, Size
, etc.The position of this option in the list of product options. Determines the option alias, e.g. if the position is 2, this option will be referred to as option2 in various API objects. Note: positions are 1-based.
The list of of option values as on Shopify. For example, option
Color
may have values: Red
, Green
, Blue
.Swatch mode determines which widget is used to render this option. Possible values are
dropdown
(default), buttons
, colors
. "Dropdown" is the default, renders a simple dropdown menu with option values. "Buttons" shows option values as clickable buttons. "Colors" shows option values as clickable color badges (requires additional settings in swatchValues
). Option swatch mode applies to all widget types.Optional configuration for swatch modes. Currently only used when
swatchValue
is colors
. In this case, will contain a map of color names (as in option values) and their corresponding color codes, e.g. { "Gold": "#FFC0CB", "Silver": "#8B4513" }
.A restriction on product option values, as defined by the merchant in PickyStory admin. This can be used to prevent certain values from being selected by customers, or for hiding certain options entirely. Additionally, a restriction may simply define the initial option value when displaying it in a widget.
Kind: global class
Restriction mode, one of
none
(default), locked
, hidden
. Falsy values are interpreted as none
mode.Option value governed by this restriction.
Map of option restrictions for this product.
Kind: global class
Kind: global class
Variant ID on Shopify. Unique across all variant objects on Shopify.
Variant title, typically a combination of the option values such as
Red / Large / Cotton
.Kind: global class
Product ID on Shopify. Unique across all product objects on Shopify.
Product handle, unique in the scope of a single store. Typically a slug-like string, e.g.
summer-t-shirt
. Handles are part of the product page URL on Shopify, e.g. /products/summer-t-shirt
.Product title as displayed to customers.
The position of this product in the list of deal products. Serves as the main identifier of this product when providing option selections to add deal products to cart (see {ProductSelection}). Note: positions are 1-based.
Full description of this product. Often contains HTML.
The featured (default) image for this product
Map of option restrictions for this product.
Return the variant matching the specified option values
Param |
---|
option1 |
option2 |
option3 |
Return the variant with the specified ID
Param |
---|
variantId |
Base class for all deals, provides common properties such as ID and category.
Kind: global class
Convert a list of
ProductSelection
objects to corresponding Variant
objects.Param |
---|
selections |
Get a
Variant
object matching the desired ID by looking up in the products of this deal. If the variant is not found, false
is returned.Param |
---|
variantId |
Param |
---|
selections |
Combination of product option values comprising a selection of a specific variant. Provided for reference.
Kind: global class
Bundle deal.
Kind: global class
Return the discount value of this deal in the default store currency.
Return the discount type for this deal.
Kind: instance property of
Bundle
Returns: string
- one of percentage
, fixedAmount
, fixedTargetPrice
Add the deal to cart by providing a list of specific product variant for each deal product.
Param | Type | Default | Description |
---|---|---|---|
variants | | selected variants, by product position in the deal | |
quantity | number | 1 | deal quantity - how many full deal instances to add, each one containing the specified variants |
Builder deal.
Kind: global class
Return the discount value of this deal in the default store currency.
Return the discount type for this deal.
Kind: instance property of
Builder
Returns: string
- one of percentage
, fixedAmount
, fixedTargetPrice
Kit - not implemented in 1.0.2.
Kind: global class
Look - not implemented in 1.0.2.
Kind: global class
Combo deal.
Kind: global class
Return the discount value of this deal in the default store currency.
Return the discount type for this deal.
Return the container
Product
of this combo. The container is an actual product in the Shopify catalog that serves as the placeholder for this combo. When adding to cart, it is replaced by the individual products assigned to this combo. This property is unique to combos.Return true if the provided selections are valid for this {Combo}
Param | Type | Description |
---|---|---|
selections | objects compatible with |
Convert a list of {ProductSelection} objects to corresponding {Variant} objects.
Param |
---|
selections |
Add to cart variants matching the specified product option selections.
Param | Description |
---|---|
selections | objects containing at least |
quantity | how many combo instances to add, e.g. if the quantity is 3 each of the variants will have 3 instances in cart |
Add the specified variants to cart.
Param | Type | Default | Description |
---|---|---|---|
variants | | objects with an optional {properties} field, see https://shopify.dev/api/ajax/reference/cart#add-line-item-properties. | |
quantity | | 1 | how many combo instances to add, e.g. if the quantity is 3 each of the variants will have 3 instances in cart |
Select option value shared by one or more products in the combo. "Single selection" must already be enabled and configured for the combo.
Param | Description |
---|---|
name | option name as on Shopify, e.g. "Color" |
value | the desired option value, e.g. "Green" |
Location
Kind: global class
True if this location is active on the current page/URL.
Main API client for PickyStory Browser API.
Kind: global class
List the supported location categories.
Get locations in a specific category.
Param | Default | Description |
---|---|---|
category | | the desired location category |
onlyActive | true | true to restrict the output locations to those active on the current page |
Create Shopify line item objects based on the specified variant objects
Kind: global function
Param | Type | Description |
---|---|---|
variants | selected variants, by product position in the deal | |
dealQuantity | number | deal quantity |
Last modified 9mo ago