Select Shipping Option
Sets the selected shipping option for the order.
Validation:
The selected shipping option must be in the list of available shipping options
The shipping option's rules are re-evaluated to ensure it's still valid
If the shipping option has
required_fieldsin itskwargs, those fields must be provided
Rule Re-evaluation:
Rules are checked again at submission time to prevent race conditions
If basket contents changed since page load, rules may now fail
If address changed since page load, geographic rules are re-evaluated
Failed rule validation returns an error and the user must select a different option
Shipping Amount Calculation:
Amount is calculated using the shipping option's configured calculator
Calculator receives current basket contents, shipping address, and currency
Available calculator types:
FreeShippingCalculator: Zero costFixedPriceCalculator: Fixed amount from shipping option configurationWeightBasedCalculator: Cost based on basket weight tiersPriceBasedCalculator: Cost based on basket amount tiersQuantityBasedCalculator: Cost based on item quantityRemoteCalculator: Cost from external serviceDataSourceCalculator: Cost per vendor/supplier
Calculated amount is stored in pre-order and added to order total
Next Pages:
If sample product discounts are available:
SampleProductPageIf retail store reservation is needed:
ReservationSelectionPageOtherwise:
PaymentOptionSelectionPage
Cascading Invalidation:
Changing shipping option resets any previously selected payment option
Required header for AJAX requests. Must be set to XMLHttpRequest for all checkout requests.
XMLHttpRequestPossible values: Session cookie header (e.g. sessionid=abc123 or osessionid=<session_id>)
Primary key of the selected shipping option
Additional required fields defined in the shipping option's kwargs.required_fields.
These fields vary based on the shipping option configuration and may include
fields like delivery_date, time_slot, etc.
Shipping option selected successfully
POST /orders/checkout/?page=ShippingOptionSelectionPage HTTP/1.1
Host: sandbox.akinon.com
x-requested-with: XMLHttpRequest
Content-Type: application/x-www-form-urlencoded
Accept: */*
Content-Length: 21
"shipping_option=1"Shipping option selected successfully
{
"context_list": [
{
"page_name": "PaymentOptionSelectionPage",
"page_slug": "paymentoptionselectionpage",
"page_context": {
"checkout_url": "https://sandbox.akinon.com/checkout/token123",
"status_url": "https://sandbox.akinon.com/checkout/status/token123",
"payment_options": [
{
"pk": 1,
"name": "Credit Card",
"slug": "credit-card",
"payment_type": "credit_card",
"payment_type_label": "Credit Card"
}
],
"unavailable_options": []
}
}
],
"pre_order": {
"basket": {
"pk": 123,
"total_amount": "150.00"
},
"shipping_address": {
"pk": 10,
"first_name": "John",
"last_name": "Doe",
"email": "john@akinon.com",
"phone_number": "+15551234567",
"line": "123 Main St",
"country": {
"pk": 1,
"code": "US",
"name": "United States"
},
"city": {
"pk": 1,
"name": "New York"
},
"township": {
"pk": 1,
"name": "Manhattan"
}
},
"billing_address": {
"pk": 10,
"first_name": "John",
"last_name": "Doe"
},
"billing_and_shipping_same": true,
"delivery_option": {
"pk": 1,
"name": "Home Delivery",
"slug": "home-delivery",
"delivery_option_type": "customer",
"sort_order": 1
},
"shipping_option": {
"pk": 1,
"name": "Standard Shipping",
"slug": "standard-shipping",
"logo": "https://cdn.akinon.com/logos/standard.png",
"shipping_amount": "9.99",
"description": "Delivery in 3-5 business days",
"kwargs": {}
},
"shipping_amount": "9.99",
"payment_option": null,
"notifications": [],
"total_amount": "159.99",
"unpaid_amount": "159.99",
"loyalty_money": null,
"currency_type_label": "USD",
"installment": null,
"redirect_to_three_d": null,
"retail_store": null,
"payment_choice": null,
"user_email": "john@akinon.com",
"phone_number": "+15551234567",
"user_phone_number": "+15551234567",
"gift_box": null,
"delivery_range": null,
"total_amount_with_interest": "159.99",
"is_guest": false,
"is_post_order": false,
"data_source_shipping_options": null,
"attribute_based_shipping_options": null
},
"errors": {},
"template_name": "orders/checkout.html"
}Last updated
Was this helpful?

