get_basket_promotions

Overview

This function finds current and upcoming active promotions.

Promotions are returned in order of start date, from earliest to latest.

Aurora Demo Example

Accepted Parameters

ParameterValuesDescriptionRequired
display_members_contentBoolean or NullLimits the returned promotions to those where display_members_content is enabled/disabledNo
itemStringThe name of the Smarty variable to assign the function resultYes
limitIntegerThe maximum number of promotions to return. Value must be between 1 and 100.No

Data Returned

An array of promotions is returned. Each promotion is an array with a number of fields describing the promotion.

The following is an example of a promotion returned by this function:

promotion_name => "Bardot dresses - Buy 1 Get 10% off an..."
start_date => "2023-01-01"
end_date => "2024-01-01"
promotion_type => "buy_x_get_y_for_z"
promotion_amount => "10.00"
promotion_amount_type => "percent"
require_login => false
coupon_required => false
product_listing_page => ""
product_details_page => ""
members_content => ""
display_members_content => true

Example template code

{get_basket_promotions item=promotions limit=10 display_members_content=true}

Errors

The following table describes the various errors this function could emit.

Error textDescription
Smarty::item is requiredThe item parameter must be specified so that the function result can be assigned to a Smarty variable.
Smarty::item value cannot contain spacesThe item parameter must not contain spaces so that it is a valid Smarty variable name.
Smarty::display_members_content must be a boolean or nullThe display_members_content parameter value may be true, false, null or omitted entirely.
Smarty::limit must be between 1 and 100The function can return between 1 and 100 promotions. The limit value must be between 1 and 100.