elgentos / magento2-hyva-checkout-ab-test
Set up an A/B test with different available Hyvä and Luma checkouts
Package info
github.com/elgentos/magento2-hyva-checkout-ab-test
Type:magento2-module
pkg:composer/elgentos/magento2-hyva-checkout-ab-test
Requires
- php: ^8.1
- hyva-themes/magento2-hyva-checkout: *
- magento/framework: *
Requires (Dev)
None
Suggests
- degdigital/magento2-customreports: Useful to check A/B test results in the Magento admin
Provides
None
Conflicts
None
Replaces
None
README
This extension allows you to set up an A/B test with different available Hyvä and the Luma fallback checkout.
You can configure a specific split between multiple checkouts, like the configured Hyva Checkout and the Luma fallback checkout. Or between the Hyva Checkout onepage version and the Hyva Checkout multi-step version.
Installation
composer require elgentos/magento2-hyva-checkout-ab-test bin/magento set:up
Configuration
You can enable the extension under Stores > Configuration > Hyvä Themes > Checkout > A/B Test.
Usage
Checkout Selection
The module determines which checkout to use based on the following priority:
-
URL Parameter Override (if allowed)
- In development mode: The
active_checkout_namespaceURL parameter can always be used to manually select a checkout - In production mode: The parameter can only be used if "Allow URL Parameter Override" is enabled in configuration
- Only checkouts with a percentage above 0 can be selected; the selection is kept for the rest of the session
- In development mode: The
-
Session Assignment: A visitor keeps the checkout assigned earlier in the session, as long as that checkout still has a percentage above 0. A checkout that is removed or set to 0% no longer takes part: its visitors are assigned again on their next request
-
Developer Mode: If no URL parameter is provided, development mode uses the default checkout configured in
hyva_themes_checkout/general/checkout, unless "Run in Developer Mode" is enabled; then visitors are assigned a checkout like in production -
Random Assignment: In production mode (without URL override), customers are randomly assigned to configured checkouts based on their percentage split
The assigned checkout is stored on the checkout session, on the quote and, when the order is placed, on the order (shown on the order view and available as a column in the order grid).
Ending the test or a variant
- Set a checkout to 0% to stop showing it; visitors assigned to it switch to one of the remaining checkouts on their next request
- Disable the A/B test to show the default checkout to everyone; orders placed while the test is disabled do not get a checkout namespace
Manual Checkout Selection via URL
You can manually override the checkout selection by adding the active_checkout_namespace query parameter:
http://store.test/checkout?active_checkout_namespace=hyva
http://store.test/checkout?active_checkout_namespace=luma
In Development Mode: This parameter always works and overrides the default checkout selection.
In Production Mode: This parameter only works if "Allow URL Parameter Override" is enabled under Stores > Configuration > Hyvä Themes > Checkout > A/B Test.
Reports
You can check the progress of the A/B test by running this query;
SET SQL_MODE=''; SELECT quote.active_checkout_namespace as checkout, COUNT(quote.entity_id) as quotes, COUNT(sales_order.quote_id) as orders, (COUNT(sales_order.quote_id) / COUNT(quote.entity_id)*100) as conversion_percentage FROM quote LEFT JOIN sales_order ON quote.entity_id = sales_order.quote_id AND sales_order.state IN ('completed', 'processing') WHERE quote.active_checkout_namespace IS NOT NULL GROUP BY quote.active_checkout_namespace;
If you want to see the results in the Magento admin, you can install degdigital/magento2-customreports and add the above query. Be sure to leave out the SQL_MODE part (Magento does this for you) and leave no trailing/leading white lines.
The report will look like this;

