Skip to main content
Returns the bonus campaign running on a product, such as double points this weekend. Returns null when there is no active campaign for the product, including once a campaign has ended, so the same check both shows and hides your notice.

Usage

Parameters

number | string
required
The product ID.

Example

When the campaign ends

Once endsAt passes, data is null on every call, even from a page that was already open, so re-running the check hides the notice. To hide it at the exact moment without re-calling, compare endsAt to the current time on a timer, as the Bonus campaign countdown recipe does. endsAt is in UTC. Pass your store’s timezone when formatting a date, otherwise customers see it in their own timezone. For a live countdown (“Ends in 2d 14h”) with a campaign pill, see the Bonus campaign countdown recipe.
To show how much the customer earns with the bonus, use getProductEarningValue. Only show bonus messaging when its bonusApplied is true.

Response

data is null when no active campaign applies to the product: none is running, the product isn’t part of it, or the campaign has ended.
string
"multiplier" (for example double points) or "tiered" (a bonus for spending over an amount).
string
The campaign name.
number
Multiplier campaigns only. For example 2 for double points.
array
Tiered campaigns only. Each tier has spendFormatted ("$500.00") and bonusFormatted ("$25.00" or "500"), plus the raw numbers spendThreshold and bonusValue.
string
When the campaign ends, as an ISO 8601 date in UTC.
object | null
Set when the campaign only applies if a specific product is in the cart: { met, productIds }, where met is true once one of productIds is in the cart. Otherwise null.
string
Error message when success is false.