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.
What it does
Section titled “What it does”- 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
Installation
Section titled “Installation”- Download
swft-bumps.zipfrom swft.co.uk/modules - Install and activate
- Go to WooCommerce → Bumps → Add New to create bump offers
Bump configuration
Section titled “Bump configuration”Each bump is a custom post type (swft_bump):
| Field | Meta key | Description |
|---|---|---|
| Product | _bump_product_id | WooCommerce product ID to add to order |
| Headline | _bump_headline | Short headline shown prominently |
| Description | _bump_description | Supporting text (optional) |
| Discount label | _bump_discount_label | e.g. “Save 30% today only” |
| Trigger | _bump_trigger_product_ids | Show bump only when these product IDs are in cart |
| Trigger category | _bump_trigger_category_ids | Show bump when cart contains product in these categories |
Extension data
Section titled “Extension data”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.
How payment works
Section titled “How payment works”When the customer accepts a bump:
- The checkout calls
POST api.swft.co.uk/sessions/{id}/apply-bumpswithaccepted_bump_ids: [789] - The API calculates the additional amount and calls
stripe.paymentIntents.update()with the new total - The accepted bumps are stored in
session_data.extensions.accepted_bumps - The WooCommerce order sync adds accepted bump products as line items
Order meta
Section titled “Order meta”| Meta key | Value |
|---|---|
_swft_ext_order_bumps | Full bumps array as JSON |
_swft_ext_accepted_bumps | Accepted bumps as JSON |
JS events
Section titled “JS events”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)})PHP hooks
Section titled “PHP hooks”// Modify which bumps are shown for a given cartadd_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 arrayadd_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 orderadd_action( 'swft_bumps_applied', function( WC_Order $order, array $accepted_bumps ): void { // notify fulfilment system}, 10, 2 );