Make line item quantities adjustable
Enable your customers to adjust the quantity of items during checkout.
A Checkout Session’s line items keep track of what your customer is purchasing. You can configure the Checkout Session so customers can adjust line item quantities during checkout.
Create a Checkout Session with an adjustable quantity
Set adjustable_
on your line_
when creating a Checkout Session to enable your customers to update the quantity of an item during checkout.
You can customize the default settings for the minimum and maximum quantities allowed by setting adjustable_
and adjustable_
. By default, an item’s minimum adjustable quantity is 0
and the maximum adjustable quantity is 99
. You can specify a value of up to 999999
for adjustable_
.
When using adjustable quantities with a line_
value greater than 99
(the default adjustable maximum), set adjustable_
to be greater than or equal to that item’s quantity.
If you use adjustable quantities, change your configuration so that it uses adjustable_
when creating the Checkout Session to reserve inventory quantity instead of the line_
quantity.
Checkout prevents the customer from removing an item if it is the only item remaining.
Handle completed transactions
After the payment completes, you can make a request for the finalized line items and their quantities. If your customer removes a line item, it is also removed from the line items response. See the Fulfillment guide to learn how to create an event handler to handle completed Checkout Sessions.
Note
To test your event handler, install the Stripe CLI and use stripe listen --forward-to localhost:4242/webhook
to forward events to your local server.