Browse Start

Run a deadline

Suppose you sell a concert shirt at a preorder price until a set time, then show the standard offer. Plandalf's promo supplies the countdown and active tier. You decide whether the deadline changes a price inside one offer or switches the button to a different offer.

1. Configure the sale

  1. Create a promo with the slug concert-merch. Set a fixed deadline, then add tiers labeled Preorder and Standard. These exact labels are used in the code below. Tier setup explains prices and windows.
  2. For an HTML-only page, publish one concert-shirt offer and connect its prices to those promo tiers.
  3. To switch checkouts in JavaScript or React, publish two offers: concert-shirt-preorder and concert-shirt-standard. Set each offer's price and completion behavior. The promo's active tier will choose which one the next click opens.
  4. Test both offers separately before adding the countdown. Replace the example organization host with yours.

2. Put the countdown beside the buy button

The browser bundle renders the countdown and applies the active promo tier price to the same offer. HTML attributes alone do not switch offer slugs.

merch.html
<script defer
  src="https://your-org.plandalf.dev/js/plandalf-sdk.js"></script>
<div data-plandalf-promo="concert-merch"></div>
<button
  data-plandalf-present="concert-shirt"
  data-plandalf-apply-promo="concert-merch"
>Buy the shirt</button>

The declarative promo monitor may follow a redirect URL configured on an active tier. Check that tier's redirect setting if the page unexpectedly navigates.

3. Test both sides of the deadline

Preview the Preorder tier and confirm the countdown, checkout name, and price. Then test with the Standard tier active and confirm the next click opens the standard checkout. A change in tier does not replace a checkout that is already open. Before testing payment, confirm both offers and their integration are explicitly configured for sandbox use; a mode: 'test' override can fall back to live for public visitors. Complete a provider-supported sandbox purchase on each side and confirm the orders on your server.

The page switch does not disable an old preorder link. If late purchases must be rejected, enforce the cutoff in your checkout or server configuration. The full event merch example explains the two-offer pattern; promo() and PromoHandle describe the live state and events.

Feature detail