Search by

webgriffe / sylius-fixtures-plugin

lruozzi9

Sylius fixtures with fixed prices, per locale translations, stock, shipping categories, plus a complete demo store.

Package info

github.com/webgriffe/sylius-fixtures-plugin

Type:sylius-plugin

pkg:composer/webgriffe/sylius-fixtures-plugin

Statistics

Installs: 1

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

dev-master / 1.0.x-dev 2026-08-31 15:20 UTC

This package is not auto-updated.

Last update: 2026-09-01 13:38:28 UTC


README

Sylius fixtures that can actually describe a real catalog: fixed prices, per locale translations, stock, shipping categories and configurable products. It also ships a complete demo store (wines, glassware and food and wine experiences) ready to be loaded on any Sylius project.

Installation

composer require webgriffe/sylius-fixtures-plugin --dev

Register the plugin in config/bundles.php:

Webgriffe\SyliusFixturesPlugin\WebgriffeSyliusFixturesPlugin::class => ['dev' => true, 'test' => true],

What it adds to the Sylius fixtures

Products

Option Description
price Price of every variant, in the currency unit (12.50), instead of the random one generated by Sylius
variant_prices Price per variant, keyed by product option value: numero_calici_2: 49.00. Several options are joined by a + (esperienza_2_giorni+partecipanti_4: 800.00), their order does not matter. price is the fallback
original_price Original price, to show a discount
on_hand Stock of every variant
shipping_category Shipping category code, assigned to every variant. Sylius never sets it, so any shipping method bound to a category would be discarded at checkout
translations name, slug, short_description and description per locale. Sylius writes the same translation in every locale
sylius_fixtures:
    suites:
        my_suite:
            fixtures:
                product:
                    options:
                        custom:
                            -   code: 'chianti_docg'
                                name: 'Chianti DOCG'
                                price: 9.50
                                on_hand: 180
                                shipping_category: 'bottles'
                                translations:
                                    it_IT:
                                        name: 'Chianti DOCG'
                                        short_description: 'Sangiovese fresco e sapido.'
                                    en_US:
                                        name: 'Chianti DOCG'
                                        short_description: 'Fresh and savoury Sangiovese.'

Shipping methods

Option Description
category_requirement match_any (default in Sylius), match_all or match_none
                shipping_method:
                    options:
                        custom:
                            standard:
                                code: 'standard'
                                name: 'Standard courier'
                                zone: 'IT'
                                category: 'bottles'
                                category_requirement: 'match_all'

Orders

The demo orders are created in the default locale of the channel, and their addresses are generated with a faker localized on the country of the address instead of the American one used by Sylius.

Sylius picks a random locale and then loads the products joining only the translation of that locale: reading the product name in another locale creates an empty translation and breaks the flush on a multi locale channel.

The demo store

Import the fixtures file of the plugin to get the webgriffe suite:

# config/packages/sylius_fixtures.yaml
imports:
    - { resource: '@WebgriffeSyliusFixturesPlugin/Resources/config/app/fixtures.yaml' }
bin/console sylius:fixtures:load webgriffe -n
# catalog promotions are applied asynchronously
bin/console messenger:consume main --time-limit=60

It creates an Italian wine shop: the ecommerce channel in three locales (it_IT, en_US, fr_FR) with prices in euro, shipping to Europe only, 27 wines, 5 configurable sets of glasses, 4 food and wine experiences (nothing to ship, VAT 10%), promotions, 20 orders, 40 reviews and 20 customers.

The pictures are public domain (CC0) photos, their origin is tracked in src/Resources/fixtures/images/CREDITS.md.

Contributing

composer install
composer suite   # ecs + phpstan + phpunit

License

This plugin is under the MIT license. See the complete license in the LICENSE file.