This article is for you if you want to create links that checkout or add multiple products to the cart at the same time.
Here are some examples of what you can achieve. With the click of a button...
...add several products to the cart at the same time
...checkout to a plan and one (or more) products
...checkout to several products at the same time
To achieve that you can use several powerful URL slugs. These work both on the checkout and the cart.
Checkout to one or several products
products={product-slug}
Creates a checkout containing exactly the specified products. Quantity is always 1
Example:
https://yourcheckouturl.com?products=honey-cookie-box,vanilla-strawberry-bar-box
That would create a checkout consisting of 1x Honey Cookie Box and 1 Vanilla Strawberry Bar Box
Checkout to one or several products and set the quantity
ordered_products[{id_number}]={quantity}
Creates a checkout containing exactly the specified products and offers a possibility to add quantity
Example:
https://yourcheckouturl.com?ordered_products[15]=2&ordered_products[16]=3
This uses product ID's instead of slugs. You can find the ID next to the product name in the product overview (click on "Products" in the sidebar)
The URL above would checkout to 2x product with the ID 15 and 3x product with the ID 16
Add one or several products to the cart
add_products={slug}
This is very useful if you are using a cart
It adds the desired products to the cart with a quantity of 1. Note that the quantity can always be adjusted by the customer.
Example:
https://yourcheckouturl.com/cart?add_products=toaster,microwave
This adds a toaster and a microwave to the cart.
Add one or several products to the cart and set the quantity
add_ordered_products[{id_number}]={quantity}
This is very useful if you are using a cart and want to set quantities.
Example:
https://yourcheckouturl.com/cart?add_ordered_products[15]=2&add_ordered_products[16]=3
This uses product ID's instead of slugs. You can find the ID next to the product name in the product overview (click on "Products" in the sidebar)
The URL above would add 2x product with the ID 15 and 3x product with the ID 16
Checkout to a plan
plan=[plan-name]
This is only relevant if you are relying on plans. The plan slug can be used in combination with any of the slugs above.
Examples:
Add a plan and a product (with a quantity) to the cart
https://yourcheckouturl.com/cart?plan=standard&add_ordered_products[15]=2
Checkout to a plan and two products
https://yourcheckouturl.com?plan=standard&products=toaster,microwave
Note that only one plan can be checked out to at the same time.
Add Pre-filled value for Extra Field
If you would like to have a value appear in one of the extra fields automatically when a customer opens the Checkout do the following:
โ
You can add a URL parameter in the URL bar in the extra_fields
attribute as a key/value combination. Here it is important to use the lowercased name of the extra field
as key in the extra_fields
attribute.
Be aware: This still allows the customer to still remove or edit the value on the Checkout form itself. You can potentially hide the field via custom JS or CSS if you do not want your customer to see or edit the field directly in the user interface.
Example:
https://yourcheckouturl.com?extra_fields[tracking_code]=11ad234f