API Reference

CartVariant

Product variant of a deal to be added to cart. Used by Deal.addVariantsToCart().

Kind: global class

cartVariant.position

The position of the product this variant belongs to inside the deal

Kind: instance property of CartVariant

cartVariant.id

Variant ID

Kind: instance property of CartVariant

cartVariant.quantity

Variant quantity

Kind: instance property of CartVariant

Image

Product image. See https://shopify.dev/api/admin-rest/latest/resources/product-image.

Kind: global class

image.height

Image height in pixels, can be null if unknown.

Kind: instance property of Image

image.width

Image width in pixels, can be null if unknown.

Kind: instance property of Image

image.src

Image URL, similar to the src property of the img tag.

Kind: instance property of Image

image.alt

Image alt value, similar to the alt property of the img tag.

Kind: instance property of Image

image.position

The position of this image inside the list of product images. Null if not applicable. Note: positions are 1-based.

Kind: instance property of Image

Option

Product option. See https://shopify.dev/api/admin-rest/latest/resources/product.

Kind: global class

option.id ⇒ number

Option ID on Shopify. Unique across all option objects on Shopify.

Kind: instance property of Option

option.name ⇒ string

Option name, e.g. Color, Size, etc.

Kind: instance property of Option Returns: string - name

option.position ⇒ number

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.

Kind: instance property of Option Returns: number - position

option.values ⇒ Array.<string>

The list of of option values as on Shopify. For example, option Color may have values: Red, Green, Blue.

Kind: instance property of Option Returns: Array.<string> - values

option.swatchMode ⇒ string

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.

Kind: instance property of Option

option.swatchValues ⇒ object

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" }.

Kind: instance property of Option

OptionRestriction

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

optionRestriction.mode ⇒ string

Restriction mode, one of none (default), locked, hidden. Falsy values are interpreted as none mode.

Kind: instance property of OptionRestriction

optionRestriction.value ⇒ string

Option value governed by this restriction.

Kind: instance property of OptionRestriction

ProductRestrictions

Map of option restrictions for this product.

Kind: global class

productRestrictions.option1 ⇒ OptionRestriction

Kind: instance property of ProductRestrictions

productRestrictions.option2 ⇒ OptionRestriction

Kind: instance property of ProductRestrictions

productRestrictions.option3 ⇒ OptionRestriction

Kind: instance property of ProductRestrictions

Variant

Product variant. See https://shopify.dev/api/admin-rest/latest/resources/product-variant.

Kind: global class

variant.id ⇒ number

Variant ID on Shopify. Unique across all variant objects on Shopify.

Kind: instance property of Variant

variant.title ⇒ string

Variant title, typically a combination of the option values such as Red / Large / Cotton.

Kind: instance property of Variant

variant.option1 ⇒ string

Kind: instance property of Variant

variant.option2 ⇒ string

Kind: instance property of Variant

variant.option3 ⇒ string

Kind: instance property of Variant

variant.price ⇒ float

Kind: instance property of Variant

variant.image ⇒ Image

Kind: instance property of Variant

variant.position ⇒ number

Kind: instance property of Variant

variant.sku ⇒ string

Kind: instance property of Variant

Product

Product object. See https://shopify.dev/api/admin-rest/latest/resources/product.

Kind: global class

product.id ⇒ number

Product ID on Shopify. Unique across all product objects on Shopify.

Kind: instance property of Product

product.handle ⇒ string

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.

Kind: instance property of Product

product.title ⇒ string

Product title as displayed to customers.

Kind: instance property of Product

product.position ⇒ number

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.

Kind: instance property of Product Returns: number - position

product.description ⇒ string

Full description of this product. Often contains HTML.

Kind: instance property of Product

product.variants ⇒ Array.<Variant>

Kind: instance property of Product

product.images ⇒ Array.<Image>

Kind: instance property of Product

product.featuredImage ⇒ Image

The featured (default) image for this product

Kind: instance property of Product

product.restrictions ⇒ ProductRestrictions

Map of option restrictions for this product.

Kind: instance property of Product

product.options ⇒ Array.<Option>

Kind: instance property of Product

product.getVariantForSelection(option1, option2, option3) ⇒ Variant

Return the variant matching the specified option values

Kind: instance method of Product

Param

option1

option2

option3

product.getVariantById(variantId) ⇒ Variant

Return the variant with the specified ID

Kind: instance method of Product

Param

variantId

Deal

Base class for all deals, provides common properties such as ID and category.

Kind: global class

deal.getVariantsForSelections(selections) ⇒ Array.<Variant>

Convert a list of ProductSelection objects to corresponding Variant objects.

Kind: instance method of Deal

Param

selections

deal.getVariantById(variantId) ⇒ Variant | Boolean

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.

Kind: instance method of Deal

Param

variantId

deal.getPriceForSelections(selections) ⇒ number | *

Kind: instance method of Deal

Param

selections

ProductSelection

Combination of product option values comprising a selection of a specific variant. Provided for reference.

Kind: global class

Bundle

Bundle deal.

Kind: global class

bundle.discountValue ⇒ float

Return the discount value of this deal in the default store currency.

Kind: instance property of Bundle

bundle.discountType ⇒ string

Return the discount type for this deal.

Kind: instance property of Bundle Returns: string - one of percentage, fixedAmount, fixedTargetPrice

bundle.addVariantsToCart(variants, quantity) ⇒ Promise.<*>

Add the deal to cart by providing a list of specific product variant for each deal product.

Kind: instance method of Bundle

ParamTypeDefaultDescription

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

Builder deal.

Kind: global class

builder.discountValue ⇒ float

Return the discount value of this deal in the default store currency.

Kind: instance property of Builder

builder.discountType ⇒ string

Return the discount type for this deal.

Kind: instance property of Builder Returns: string - one of percentage, fixedAmount, fixedTargetPrice

Kit

Kit - not implemented in 1.0.2.

Kind: global class

Look

Look - not implemented in 1.0.2.

Kind: global class

Combo

Combo deal.

Kind: global class

combo.discountValue ⇒ float

Return the discount value of this deal in the default store currency.

Kind: instance property of Combo

combo.discountType ⇒ string

Return the discount type for this deal.

Kind: instance property of Combo Returns: string - one of percentage, fixedAmount, fixedTargetPrice

combo.containerProduct ⇒ Combo

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.

Kind: instance property of Combo

combo.validateSelections(selections) ⇒ Boolean

Return true if the provided selections are valid for this {Combo}

Kind: instance method of Combo Returns: Boolean - valid or not

ParamTypeDescription

selections

objects compatible with

combo.getVariantsForSelections(selections) ⇒ Array.<Variant>

Convert a list of {ProductSelection} objects to corresponding {Variant} objects.

Kind: instance method of Combo

Param

selections

combo.addSelectionsToCart(selections, quantity) ⇒ Promise.<*>

Add to cart variants matching the specified product option selections.

Kind: instance method of Combo

ParamDescription

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

combo.addVariantsToCart(variants, quantity) ⇒ Promise.<*>

Add the specified variants to cart.

Kind: instance method of Combo Returns: Promise.<*> - when the API operation is completed

ParamTypeDefaultDescription

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

combo.selectCommonOption(name, value)

Select option value shared by one or more products in the combo. "Single selection" must already be enabled and configured for the combo.

Kind: instance method of Combo

ParamDescription

name

option name as on Shopify, e.g. "Color"

value

the desired option value, e.g. "Green"

Location

Location

Kind: global class

Kind: instance property of Location

location.isActive ⇒ boolean

True if this location is active on the current page/URL.

Kind: instance property of Location

BrowserApi

Main API client for PickyStory Browser API.

Kind: global class

browserApi.categories ⇒ Array.<string>

List the supported location categories.

Kind: instance property of BrowserApi

browserApi.getLocations(category, onlyActive) ⇒ Array.<Location>

Get locations in a specific category.

Kind: instance method of BrowserApi

ParamDefaultDescription

category

the desired location category

onlyActive

true

true to restrict the output locations to those active on the current page

makeLineItems(variants, dealQuantity) ⇒ *

Create Shopify line item objects based on the specified variant objects

Kind: global function

ParamTypeDescription

variants

selected variants, by product position in the deal

dealQuantity

number

deal quantity

Last updated