Skip to content

SwftBumps

Order bumps for Swft Checkout. Offer additional products at a discounted price on the payment step. Accepted bumps are added to the Stripe PaymentIntent amount and included in the WooCommerce order.

  • Define bump offers: a product, a headline, a description, and an optional discount
  • Bumps appear on the payment step of the Swft Checkout, below the review strip
  • Customer accepts or declines with a single click
  • Accepted bumps update the Stripe PaymentIntent amount via POST /sessions/:id/apply-bumps
  • Accepted bumps are added to the WooCommerce order as line items
  1. Download swft-bumps.zip from swft.co.uk/modules
  2. Install and activate
  3. Go to WooCommerce → Bumps → Add New to create bump offers

Each bump is a custom post type (swft_bump):

FieldMeta keyDescription
Product_bump_product_idWooCommerce product ID to add to order
Headline_bump_headlineShort headline shown prominently
Description_bump_descriptionSupporting text (optional)
Discount label_bump_discount_labele.g. “Save 30% today only”
Trigger_bump_trigger_product_idsShow bump only when these product IDs are in cart
Trigger category_bump_trigger_category_idsShow bump when cart contains product in these categories

SwftBumps adds the following to extensions.order_bumps in the session:

[
{
"product_id": 789,
"name": "Premium Packaging",
"headline": "Add premium packaging for just £3",
"description": "Black gift box with ribbon. Limited to one per order.",
"price": 300,
"original_price": 500,
"discount_label": "40% off today",
"image": "https://yourstore.com/wp-content/uploads/box.jpg",
"sku": "PREM-BOX-01"
}
]

The checkout frontend reads this and renders the bump UI on the payment step.

When the customer accepts a bump:

  1. The checkout calls POST api.swft.co.uk/sessions/{id}/apply-bumps with accepted_bump_ids: [789]
  2. The API calculates the additional amount and calls stripe.paymentIntents.update() with the new total
  3. The accepted bumps are stored in session_data.extensions.accepted_bumps
  4. The WooCommerce order sync adds accepted bump products as line items
Meta keyValue
_swft_ext_order_bumpsFull bumps array as JSON
_swft_ext_accepted_bumpsAccepted bumps as JSON
document.addEventListener('swftcheckout:ready', () => {
// Bumps are shown automatically if extensions.order_bumps is non-empty.
// Listen for this event if you need to react when bumps render.
})
document.addEventListener('swftcheckout:upsell-shown', (e) => {
// Fires when the bump UI renders
console.log(e.detail.products)
})
// Modify which bumps are shown for a given cart
add_filter( 'swft_bumps_for_cart', function( array $bumps, WC_Cart $cart ): array {
// Remove a bump if a condition is met
return array_filter( $bumps, fn( $b ) => $b['product_id'] !== 999 );
}, 10, 2 );
// Add custom data to each bump object in the extensions array
add_filter( 'swft_bump_extension_data', function( array $bump, int $product_id ): array {
$bump['stock_remaining'] = get_post_meta( $product_id, '_stock', true );
return $bump;
}, 10, 2 );
// Fired after bumps are applied to the order
add_action( 'swft_bumps_applied', function( WC_Order $order, array $accepted_bumps ): void {
// notify fulfilment system
}, 10, 2 );