Auto-Selecting a Product Variant

Example


It is possible to auto-select or pre-select the product options or variations on the first step of your Celery checkout.

For example, where your product options might encompass four variants like this:


Your checkout would normally start by asking your customers which options they want for Corn Color and Flavor like this:




If you pre-select some options from the moment your customer clicked the button on your website to launch the Celery checkout, your customers will see the option values for Corn Color and Flavor pre-selected on their behalf like this:



Notice how the options White and Butter are already pre-selected. In this case, you could, for example, create four buttons on your website where each button launches the same Celery product checkout but pre-selects one of each of the four product variations.

To achieve this, you'll want to add an extra step to the standard install or embed instructions.

Instructions


Note: This feature only works with Products at the moment and does not work with Collections.

You'll need to add this parameter snippet inside the opening tag of the element that launches your checkout on your website:
data-celery-sku="your-sku"
Replace the SKU "your-sku" with the one you want to be preselected. It should be set in your product. If you didn't set a a SKU yet because it's optional, you'll want to do that now too.

In the example above and the first screenshot, the SKU used to represent the product options White and Butter is "WHT-BTTR" so we would add it as:
data-celery-sku="WHT-BTTR"
For example, if your standard overlay Celery checkout embed code looks like this:
<button data-celery="53d6f6ba8dd75c1c0059712f" data-celery-version="v2">Checkout</button>
You'll want to add the extra parameter into your overlay code like this:
<button data-celery="53d6f6ba8dd75c1c0059712f" data-celery-version="v2" data-celery-sku="your-sku">Checkout</button>

Related 


It's also possible to auto-add a product and skip the first step of checkout. This can be done either separately or in conjunction with pre-selecting a product variant. 

If you'd like to auto-add a product please see the article for Auto-Adding a Product.

Feedback and Knowledge Base