Next Commerce
Bundle Selector

Bundle Vouchers

Assign voucher/coupon codes to individual bundle cards. When the visitor switches bundles, the previous card's codes are removed and the new card's codes are applied — automatically, without additional configuration.

<!-- Via attribute (static card) -->
<div data-next-bundle-card
     data-next-bundle-id="premium"
     data-next-bundle-vouchers="SAVE10,FREESHIP"
     data-next-bundle-items='[{"packageId":10,"quantity":2}]'>
  Premium Bundle
</div>
// Via auto-render JSON definition
{
  "id": "premium",
  "vouchers": ["SAVE10", "FREESHIP"],
  "items": [{ "packageId": 10, "quantity": 2 }]
}

Vouchers declared this way are managed entirely by the bundle selector. Do not manage bundle vouchers separately using the coupon input element.


How Voucher Swaps Work

Voucher changes run before the cart write. When the selection changes from card A to card B:

  1. Any voucher on A that is not on B is removed from checkout
  2. Any voucher on B that is not already applied is added
  3. Vouchers shared between A and B are left untouched
  4. calculateTotals() is called to reflect the new coupon state in price displays

Bundle-managed vouchers are tracked across all bundle selectors on the page. When the voucher list changes, only the user-entered portion (codes not belonging to any bundle) is diffed — a bundle swap that adds or removes bundle vouchers will not trigger a redundant price re-fetch.

On this page