What's new at ShopWired?
Add multiple products to basket using a URL
A new feature has been added that allows multiple products to be added to a visitor’s shopping basket using a single URL.
This feature works by sending a request to the /checkout/basket endpoint with query parameters that specify the SKUs and quantities of the products that should be added.
The feature was introduced primarily to support external platforms that require checkout URLs which add multiple products to a basket, such as Facebook's checkout link system.
For more information about Facebook checkout URLs, see:
https://developers.facebook.com/docs/commerce-platform/setup-checkout-url.
How the feature works
Multiple products can now be added to the basket by sending a request to /checkout/basket.
The request must include the add_items parameter and one or more item parameters specifying SKU codes and quantities.
e.g.
/checkout/basket?add_items=1&item[SKU1]=2&item[SKU2]=1
This request would:
- add the product with SKU
SKU1with a quantity of2 - add the product with SKU
SKU2with a quantity of1
Up to approximately 50 products can be added in a single request.
Supporting extras and choices
The URL also supports attaching product extras and product choices to specific SKUs.
Extras and choices are specified using their unique IDs and must reference the same SKU used in the item parameter.
Example:
/checkout/basket?add_items=1&item[SKU1]=2&extras[SKU1]=11&item[SKU2]=1&extras[SKU2]=22,33&choices[SKU2]=44
In this example:
SKU1is added with quantity2and extra11SKU2is added with quantity1- extras
22and33are applied toSKU2 - choice
44is applied toSKU2
Invalid values are ignored during processing.
Intended use
This feature is designed primarily for integrations where products need to be preloaded into a visitor’s basket from an external platform.
A common use case is when platforms such as Facebook redirect users to a store with predefined products ready to purchase.
Related documentation
For full instructions on constructing URLs using this feature see the help guide, adding multiple products to the basket using a URL.