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
Example
When the campaign ends
OnceendsAt 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.
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.
Tiered campaigns only. Each tier has
spendFormatted ("$500.00") and bonusFormatted ("$25.00" or "500"), plus the raw numbers spendThreshold and bonusValue.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.