BigCommerce helper functions
You can use the helper functions listed below when developing templates for use with the BigCommerce connector.
Please note that some functions are only compatible with certain template types.
$getId
$getId
Returns the sanitized ID of the current product, variation, or category, prioritizing the SKU over the ID field.
Template compatibility: item
, variation
, item group
, and grouping
Input
None
Examples
/* with a category */
$getId()
=> '1'
/* with a product or variation */
$getId()
=> 'sku'
$getURL
$getURL
Returns the URL of the current product or variation.
Template compatibility: item
, variation
, and grouping
Input
None
Examples
$getUrl()
=> 'https://www.example.com/product-1'
$getKeywords
$getKeywords
Merges both the search and meta keywords from the current product, filters invalid keywords, and returns the result.
Template compatibility: item
Input
None
Examples
$getKeywords()
=> ['clothing', 't-shirt']
$getDefaultPrice
$getDefaultPrice
Returns the default price according to a specified price field for the current variation.
When only one channel is present, it calls getPriceAs passing the single channel's id and default currency. An error is thrown otherwise.
The price field can be one of:
price
sale_price
retail_price
map_price
calculated_price
Template compatibility: variation
and grouping
Input
None
Examples
$getDefaultPrice('price')
=> 42
$getPriceAs
$getPriceAs
Returns the price based on a price field, currency code and channel for the current variation.
The following priority list will be used:
- If there is a price list for this currency + channel with this specific price field, it will be returned.
- If the variation has this price field, we return it converted to the desired currency.
- Otherwise, we use the base product price field and return it converted to the desired currency according to the exchange rate.
The price field can be one of:
price
sale_price
retail_price
map_price
calculated_price
Template compatibility: variation
and grouping
Input
None
Examples
$getPriceAs('price', 'USD', 'default_channel')
=> 42
Updated about 2 months ago