mudrak / one-page-checkout-plugin
One Page Checkout plugin for Sylius.
Package info
github.com/Sajgon27/sylius_onepagecheckout
Type:sylius-plugin
pkg:composer/mudrak/one-page-checkout-plugin
Requires
- php: ^8.2
- sylius/sylius: ^2.0
Requires (Dev)
- behat/behat: ^3.16
- dbrekelmans/bdi: ^1.4
- dmore/behat-chrome-extension: ^1.4
- dmore/chrome-mink-driver: ^2.9
- friends-of-behat/mink: ^1.11
- friends-of-behat/mink-browserkit-driver: ^1.6
- friends-of-behat/mink-debug-extension: ^2.1
- friends-of-behat/mink-extension: ^2.7
- friends-of-behat/page-object-extension: ^0.3
- friends-of-behat/suite-settings-extension: ^1.1
- friends-of-behat/symfony-extension: ^2.6
- friends-of-behat/variadic-extension: ^1.6
- nyholm/psr7: ^1.8
- phpstan/phpstan: ^1.12
- phpstan/phpstan-doctrine: ^1.3
- phpstan/phpstan-webmozart-assert: ^1.2
- phpunit/phpunit: ^10.5
- sylius-labs/coding-standard: ^4.4
- sylius-labs/suite-tags-extension: ~0.2
- sylius/sylius-rector: ^2.0
- sylius/test-application: ^2.0.0@alpha
- symfony/browser-kit: ^6.4 || ^7.4
- symfony/debug-bundle: ^6.4 || ^7.4
- symfony/dotenv: ^6.4 || ^7.4
- symfony/http-client: ^6.4 || ^7.4
- symfony/intl: ^6.4 || ^7.4
- symfony/runtime: ^6.4 || ^7.4
- symfony/web-profiler-bundle: ^6.4 || ^7.4
- symfony/webpack-encore-bundle: ^2.2
README
Mudrak One Page Checkout Plugin
A Sylius plugin that replaces the default multi-step checkout with a single-page checkout experience using Symfony UX Live Components.
Features
- Single-page checkout — Address, shipping, payment, and order completion on one page
- Live Components — Real-time updates without full page reloads (powered by Symfony UX Live Components)
- Automatic order processing — Shipping and payment selections update the order in real-time
- Simplified checkout flow — Modified state machine allows completing the order directly from the cart state
- Sylius Twig Hooks — Modular components rendered via Sylius Twig Hooks for easy customization
- Bootstrap 5 — Styled with Bootstrap 5 form themes
Requirements
- PHP ^8.2
- Sylius ^2.0
- Symfony UX Live Component (included with Sylius 2.0)
Installation
Step 1: Require the plugin via Composer
composer require mudrak/one-page-checkout-plugin
Step 2: Register the bundle
Add the plugin to your config/bundles.php:
return [ // ... other bundles Mudrak\OnePageCheckoutPlugin\MudrakOnePageCheckoutPlugin::class => ['all' => true], ];
Step 3: Import plugin configuration
Create config/packages/mudrak_one_page_checkout.yaml:
imports: - { resource: "@MudrakOnePageCheckoutPlugin/config/config.yaml" }
Step 4: Import routes
Create config/routes/mudrak_one_page_checkout.yaml:
mudrak_one_page_checkout_shop: resource: "@MudrakOnePageCheckoutPlugin/config/routes/shop.yaml"
Step 5: Ensure Live Component routes are loaded
Sylius 2.0 should already include these, but verify that your project has the Live Component route loaded (typically in config/routes/ux_live_component.yaml or similar):
live_component: resource: '@LiveComponentBundle/config/routes.php'
If it doesn't exist, create it. Live Components require this route for AJAX re-renders.
Step 6: Clear cache and rebuild assets
bin/console cache:clear
If you're using Webpack Encore, rebuild your frontend assets:
yarn install yarn build
Step 7: Verify the installation
- Make sure you have at least one product, shipping method, and payment method configured (or load fixtures with
bin/console sylius:fixtures:load -n) - Add a product to the cart
- Navigate to:
http://your-app/{locale}/one-page-checkout(e.g.,http://localhost/en_US/one-page-checkout)
You should see the one-page checkout with address form, payment, shipping, summary, and order completion — all on a single page.
How It Works
Architecture
The plugin provides a single checkout page built with Symfony UX Live Components:
| Component | Purpose |
|---|---|
OnePageCheckoutComponent |
Main checkout form — handles billing & shipping address |
Payment |
Payment method selection |
Shipment |
Shipping method selection |
Summary |
Order summary (updates live when shipping/payment changes) |
Complete |
Order completion button — applies the checkout state machine transition |
State Machine Modification
The plugin modifies the sylius_order_checkout workflow to allow the complete transition directly from the cart, payment_selected, and payment_skipped states. This is required because the one-page checkout doesn't follow the standard multi-step flow.
Route
The plugin registers a single shop route:
GET|PUT|POST /{_locale}/one-page-checkout
Twig Hooks
The sidebar components (Payment, Shipment, Summary, Complete) are rendered via Sylius Twig Hooks:
one_page_checkout_paymentone_page_checkout_shipmentone_page_checkout_summaryone_page_checkout_complete
You can override any of these hooks in your application to customize the checkout experience.
Customization
Overriding templates
To override any plugin template, create the corresponding file in your application's templates/bundles/MudrakOnePageCheckoutPlugin/ directory:
templates/
└── bundles/
└── MudrakOnePageCheckoutPlugin/
├── shop/
│ └── one_page_checkout.html.twig
└── components/
└── OnePageCheckout/
├── OnePageCheckoutComponent.html.twig
├── Payment.html.twig
├── Shipment.html.twig
├── Summary.html.twig
└── Complete.html.twig
Overriding Twig Hooks
You can replace or extend individual checkout sections by overriding the twig hooks in your application's configuration:
# config/packages/mudrak_one_page_checkout.yaml sylius_twig_hooks: hooks: one_page_checkout_summary: my_custom_summary: template: 'shop/checkout/my_custom_summary.html.twig' priority: 10
Development
Running the plugin in isolation (for contributors)
Docker
make init
make database-init
make load-fixtures # optional
App available at http://localhost.
Traditional
(cd vendor/sylius/test-application && yarn install) (cd vendor/sylius/test-application && yarn build) vendor/bin/console assets:install vendor/bin/console doctrine:database:create vendor/bin/console doctrine:migrations:migrate -n vendor/bin/console sylius:fixtures:load -n symfony server:start -d
Tests
# PHPUnit vendor/bin/phpunit # Behat (non-JS) vendor/bin/behat --strict --tags="~@javascript&&~@mink:chromedriver" # PHPStan vendor/bin/phpstan analyse -c phpstan.neon -l max src/ # Coding Standards vendor/bin/ecs check
License
This plugin is released under the MIT License.