Browser API
  • Browser API
    • Getting Started
    • Examples
      • Combos
      • Bundles
      • Bundle builders
      • Kits
      • Looks
      • Common
    • API Reference
    • API Events
    • Release history
    • Why PickyStory
    • License
Powered by GitBook
On this page
  • CartVariant
  • Image
  • Option
  • OptionRestriction
  • ProductRestrictions
  • Variant
  • Product
  • Deal
  • ProductSelection
  • Bundle
  • Builder
  • Kit
  • Look
  • Combo
  • Location
  • BrowserApi
  • makeLineItems(variants, dealQuantity) ⇒ *

Was this helpful?

  1. Browser API

API Reference

PreviousExamplesNextAPI Events

Last updated 2 years ago

Was this helpful?

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.id

Variant ID

Kind: instance property of

cartVariant.quantity

Variant quantity

Kind: instance property of

Image

Kind: global class

image.height

Image height in pixels, can be null if unknown.

image.width

Image width in pixels, can be null if unknown.

image.src

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

image.alt

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

image.position

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

Option

Kind: global class

option.id ⇒ number

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

option.name ⇒ string

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

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.

option.values ⇒ Array.<string>

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

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.

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

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.

optionRestriction.value ⇒ string

Option value governed by this restriction.

ProductRestrictions

Map of option restrictions for this product.

Kind: global class

Variant

Kind: global class

variant.id ⇒ number

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

variant.title ⇒ string

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

variant.option1 ⇒ string

variant.option2 ⇒ string

variant.option3 ⇒ string

variant.price ⇒ float

variant.position ⇒ number

variant.sku ⇒ string

Product

Kind: global class

product.id ⇒ number

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

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.

product.title ⇒ string

Product title as displayed to customers.

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.

product.description ⇒ string

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

Deal

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

deal.getPriceForSelections(selections) ⇒ number | *

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.

bundle.discountType ⇒ string

Return the discount type for this deal.

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

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

Builder deal.

Kind: global class

builder.discountValue ⇒ float

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

builder.discountType ⇒ string

Return the discount type for this deal.

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.

combo.discountType ⇒ string

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.

combo.validateSelections(selections) ⇒ Boolean

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

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

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

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

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

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.

Param
Description

name

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

value

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

Location

Location

Kind: global class

location.isActive ⇒ boolean

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

BrowserApi

Main API client for PickyStory Browser API.

Kind: global class

browserApi.categories ⇒ Array.<string>

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

makeLineItems(variants, dealQuantity) ⇒ *

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

Product image. See .

Kind: instance property of

Kind: instance property of

Kind: instance property of

Kind: instance property of

Kind: instance property of

Product option. See .

⇒ number

⇒ string

⇒ number

⇒ Array.<string>

⇒ string

⇒ object

Kind: instance property of

Kind: instance property of Returns: string - name

Kind: instance property of Returns: number - position

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

Kind: instance property of

Kind: instance property of

⇒ string

⇒ string

Kind: instance property of

Kind: instance property of

⇒

⇒

⇒

productRestrictions.option1 ⇒

Kind: instance property of

productRestrictions.option2 ⇒

Kind: instance property of

productRestrictions.option3 ⇒

Kind: instance property of

Product variant. See .

⇒ number

⇒ string

⇒ string

⇒ string

⇒ string

⇒ float

⇒

⇒ number

⇒ string

Kind: instance property of

Kind: instance property of

Kind: instance property of

Kind: instance property of

Kind: instance property of

Kind: instance property of

variant.image ⇒

Kind: instance property of

Kind: instance property of

Kind: instance property of

Product object. See .

⇒ number

⇒ string

⇒ string

⇒ number

⇒ string

⇒

⇒

⇒

⇒

⇒

⇒

⇒

Kind: instance property of

Kind: instance property of

Kind: instance property of

Kind: instance property of Returns: number - position

Kind: instance property of

product.variants ⇒

Kind: instance property of

product.images ⇒

Kind: instance property of

product.featuredImage ⇒

Kind: instance property of

product.restrictions ⇒

Kind: instance property of

product.options ⇒

Kind: instance property of

product.getVariantForSelection(option1, option2, option3) ⇒

Kind: instance method of

product.getVariantById(variantId) ⇒

Kind: instance method of

⇒

⇒ | Boolean

⇒ number | *

deal.getVariantsForSelections(selections) ⇒

Kind: instance method of

deal.getVariantById(variantId) ⇒ | Boolean

Kind: instance method of

Kind: instance method of

⇒ float

⇒ string

⇒ Promise.<*>

Kind: instance property of

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

Kind: instance method of

⇒ float

⇒ string

Kind: instance property of

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

⇒ float

⇒ string

⇒

⇒ Boolean

⇒

⇒ Promise.<*>

⇒ Promise.<*>

Kind: instance property of

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

combo.containerProduct ⇒

Kind: instance property of

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

combo.getVariantsForSelections(selections) ⇒

Kind: instance method of

Kind: instance method of

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

Kind: instance method of

⇒ | | | |

⇒ boolean

location.deals ⇒ | | | |

Kind: instance property of

Kind: instance property of

⇒ Array.<string>

⇒

Kind: instance property of

browserApi.getLocations(category, onlyActive) ⇒

Kind: instance method of

https://shopify.dev/api/admin-rest/latest/resources/product-image
https://shopify.dev/api/admin-rest/latest/resources/product
https://shopify.dev/api/admin-rest/latest/resources/product-variant
https://shopify.dev/api/admin-rest/latest/resources/product
CartVariant
.position
.id
.quantity
CartVariant
CartVariant
CartVariant
Image
.height
.width
.src
.alt
.position
Image
Image
Image
Image
Image
Option
.id
.name
.position
.values
.swatchMode
.swatchValues
Option
Option
Option
Option
Option
Option
OptionRestriction
.mode
.value
OptionRestriction
OptionRestriction
ProductRestrictions
.option1
OptionRestriction
.option2
OptionRestriction
.option3
OptionRestriction
OptionRestriction
ProductRestrictions
OptionRestriction
ProductRestrictions
OptionRestriction
ProductRestrictions
Variant
.id
.title
.option1
.option2
.option3
.price
.image
Image
.position
.sku
Variant
Variant
Variant
Variant
Variant
Variant
Image
Variant
Variant
Variant
Product
.id
.handle
.title
.position
.description
.variants
Array.<Variant>
.images
Array.<Image>
.featuredImage
Image
.restrictions
ProductRestrictions
.options
Array.<Option>
.getVariantForSelection(option1, option2, option3)
Variant
.getVariantById(variantId)
Variant
Product
Product
Product
Product
Product
Array.<Variant>
Product
Array.<Image>
Product
Image
Product
ProductRestrictions
Product
Array.<Option>
Product
Variant
Product
Variant
Product
Deal
.getVariantsForSelections(selections)
Array.<Variant>
.getVariantById(variantId)
Variant
.getPriceForSelections(selections)
Array.<Variant>
Deal
Variant
Deal
Deal
Bundle
.discountValue
.discountType
.addVariantsToCart(variants, quantity)
Bundle
Bundle
Bundle
Builder
.discountValue
.discountType
Builder
Builder
Combo
.discountValue
.discountType
.containerProduct
Combo
.validateSelections(selections)
.getVariantsForSelections(selections)
Array.<Variant>
.addSelectionsToCart(selections, quantity)
.addVariantsToCart(variants, quantity)
.selectCommonOption(name, value)
Combo
Combo
Combo
Combo
Combo
Array.<Variant>
Combo
Combo
Combo
Combo
Location
.deals
Array.<Combo>
Array.<Bundle>
Array.<Builder>
Array.<Kit>
Array.<Look>
.isActive
Array.<Combo>
Array.<Bundle>
Array.<Builder>
Array.<Kit>
Array.<Look>
Location
Location
BrowserApi
.categories
.getLocations(category, onlyActive)
Array.<Location>
BrowserApi
Array.<Location>
BrowserApi
Array.<CartVariant>
ProductSelection
Variant
Array.<CartVariant>