Select or decline sample products
Accepts the user's sample product selection. The user can either select one or more products (up to allowed_quantity) or submit an empty list to explicitly decline all sample products.
Fields:
sample_products: List of product PKs to add as samples. Must be from the available sample product IDs for the current basket discounts. Duplicates are deduplicated automatically. Can be an empty list to decline all samples.
Validation:
The number of selected products must not exceed
allowed_quantity. If it does, a validation error is returned.Each submitted PK must belong to the set of available sample products for the current offer discount applications.
State Update:
If products are selected:
pre_order.data['sample_products']is set to the selected product list.If the list is empty (decline):
pre_order.data['unwanted_sample_products']is set totrueandsample_productsis removed.
Backward Navigation:
When navigating backward, both
sample_productsandunwanted_sample_productsare removed frompre_order.data.
Next Pages:
PaymentOptionSelectionPage
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>)
List of product PKs to add as sample products. Must be from the set of
available sample products for the current basket's offer discount applications.
Duplicates are deduplicated automatically. Submit an empty array to explicitly
decline all sample products (sets unwanted_sample_products = true).
The count must not exceed the allowed_quantity returned in the page context.
[101]Sample product selection applied or validation error
POST /orders/checkout/?page=SampleProductPage HTTP/1.1
Host: sandbox.akinon.com
x-requested-with: XMLHttpRequest
Content-Type: application/x-www-form-urlencoded
Accept: */*
Content-Length: 25
"sample_products=[101]"Sample product selection applied or validation error
{
"context_list": [
{
"page_name": "PaymentOptionSelectionPage",
"page_slug": "paymentoptionselectionpage",
"page_context": {
"payment_options": [],
"unavailable_options": []
}
}
],
"pre_order": {
"user_email": "user@akinon.com"
},
"errors": {},
"template_name": "orders/checkout.html"
}Last updated
Was this helpful?

