# elgentos/magento2-hyva-checkout-ab-test

> Set up an A/B test with different available Hyvä and Luma checkouts

`composer require elgentos/magento2-hyva-checkout-ab-test`

Canonical URL: https://packagento.com/elgentos/magento2-hyva-checkout-ab-test

## At a glance

- **Vendor**: elgentos (https://packagento.com/elgentos.md)
- **Latest version**: 2.0.3 — released 2026-02-27
- **Pricing**: Free
- **Package type**: Magento 2 module
- **Status**: active, accepting new buyers

## Installation

Packagento is licence-gated, so even free packages need a licence on a project before Composer can resolve them.

1. **Sign in or create an account** at https://packagento.com/customer/account/.

2. **Add the package to your account.** Open https://packagento.com/elgentos/magento2-hyva-checkout-ab-test and complete the free checkout. A licence is minted automatically.

3. **Create or pick a project, then activate the licence on it.**
   - Projects represent the Magento installs you deploy to. Manage them at https://packagento.com/projects/.
   - Activate the new licence on the project you'll deploy this package to. Activation is what generates the Composer credentials scoped to that project.

4. **Add the project credentials to your Magento codebase.**

   Grab the project's public + private key from https://packagento.com/projects/ (open the project, then its Credentials tab), and add them to `auth.json`:

   ```json
   {
     "http-basic": {
       "packagento.com": {
         "username": "ppk_live_...",
         "password": "psk_live_..."
       }
     }
   }
   ```

   Add the Packagento Composer repository to `composer.json`:

   ```json
   {
     "repositories": [
       { "type": "composer", "url": "https://packagento.com" }
     ]
   }
   ```

5. **Install and apply.**

   ```bash
   composer require elgentos/magento2-hyva-checkout-ab-test:*
   bin/magento setup:upgrade
   bin/magento setup:di:compile
   bin/magento cache:flush
   ```

## What it does

Set up an A/B test with different available Hyvä and Luma checkouts

## 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

```bash
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.

![image](https://user-images.githubusercontent.com/431360/201086503-6c54b1e0-68bd-4ec2-ab6b-e85bb52854b5.png)

### Usage

#### Checkout Selection

The module determines which checkout to use based on the following priority:

1. **URL Parameter Override** (if allowed)
   - In **development mode**: The `active_checkout_namespace` URL 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

2. **Developer Mode**: If no URL parameter is provided, development mode always uses the default checkout configured in `hyva_themes_checkout/general/checkout`

3. **Random Assignment**: In production mode (without URL override), customers are randomly assigned to configured checkouts based on their percentage split

#### 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;

```sql
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](https://github.com/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;

![image](https://user-images.githubusercontent.com/431360/200922747-6be0d031-3156-40cd-a989-c8399d4daae3.png)

## Recent Versions

| Version | Released |
|---|---|
| 2.0.3 | 2026-02-27 |
| 2.0.2 | 2026-02-27 |
| 2.0.1 | 2024-12-17 |
| 2.0.0 | 2024-12-17 |
| 1.0.5 | 2022-11-10 |
| 1.0.4 | 2022-11-10 |
| 1.0.3 | 2022-11-10 |
| 1.0.2 | 2022-11-10 |
| 1.0.1 | 2022-11-09 |
| 1.0.0 | 2022-11-09 |

## Dependencies

### Require

| Package | Constraint |
|---|---|
| hyva-themes/magento2-hyva-checkout | * |
| magento/framework | * |
| php | ^8.1 |

### Suggest

| Package | Constraint |
|---|---|
| degdigital/magento2-customreports | Useful to check A/B test results in the Magento admin |

## Quality

Latest release (2.0.3) passes the Packagento QA pipeline. Verdicts below are per-cell (Magento line × PHP version) for the matrixed tools, and run-once for the static / security tiers.


### Compatibility

Each Magento line is installed on its supported PHP versions, then the module is built (DI compile + static-content deploy). Cells show passed / failed / untested; staircase gaps render as `–`.

| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | not tested | not tested | – | – |
| 2.4.8 | – | not tested | not tested | – |
| 2.4.9 | – | – | not tested | not tested |


### Code Quality

Advisory checks against the module's source. Never affect the Compatibility verdict — a phpcs finding can't make a module incompatible.

#### Static Analysis

Coding standards (phpcs), mess detection (phpmd), copy-pasted code (cpd), PHP cross-version compatibility, composer.json validity. Each runs once for the whole module.

| Tool | Status | Findings | Summary |
|---|---|---|---|
| PHPCS | Warning | 6 | 6 warnings (ruleset: Magento2) — 1 auto-fixable with phpcbf |
| PHPMD | Warning | 1 | 1 rule violation (UnusedFormalParameter:1) |
| Cpd | Pass | 0 |  |
| Composer validate | Info | 2 | valid; 2 advisory notes (composer validate --strict) |

#### PHPStan

Type-checks the module against a real Magento install. Re-runs per Magento + PHP version because resolvable symbols differ between releases.

| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | Error | Error | – | – |
| 2.4.8 | – | Error | Error | – |
| 2.4.9 | – | – | Error | Error |


### Tests

Unit and integration suites run per Magento + PHP cell. Test failures speak to the module's behaviour, not its compatibility with a line, so they're reported here separately.

#### Unit Tests

| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | N/A | N/A | – | – |
| 2.4.8 | – | N/A | N/A | – |
| 2.4.9 | – | – | N/A | N/A |

#### Integration Tests

| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | N/A | N/A | – | – |
| 2.4.8 | – | N/A | N/A | – |
| 2.4.9 | – | – | N/A | N/A |


### Security

Dependency-advisory audit (composer audit) plus a source malware scan. A malware detection fails the version outright.

| Tool | Status | Findings | Summary |
|---|---|---|---|
| Composer audit | N/A | 0 | no resolvable dependency tree to audit — Your requirements could not be resolved to an installable set of packages. Problem 1 |
| Malware scan | Pass | 0 |  |

## Licence and pricing

Free. A licence is still minted on checkout and bound to your project for Composer access — no payment step.

Refundable within 14 days of first purchase via https://packagento.com/account/refunds/.

## Install via Claude Code or any MCP client

The Packagento MCP server can run the licence + project + Composer steps above in one tool call:

```
purchase_and_install_packages(
  composer_names=["elgentos/magento2-hyva-checkout-ab-test"],
  project_id="proj_xxx"
)
```

This handles cart, checkout, licence minting, project activation, and writes auth.json credentials. Connect a client with `claude mcp add packagento https://mcp.packagento.com`. Full setup at https://packagento.com/docs/mcp-setup.

## Vendor

elgentos is a Magento 2 vendor on Packagento. See https://packagento.com/elgentos.md for their full catalogue.

