Generating fixtures

The invoicing plugin uses ShopBillingData entities to populate default invoice details (e.g., company name, tax ID, address) per channel. Fixtures help you load these billing data entries automatically during development or initial project setup.

Step-by-Step Configuration

1. Create a Fixture File

Create a new YAML file in config/packages, for example:

config/packages/my_own_company_fixtures.yaml

2. Define Your Channel and Shop Billing Data

Fill your fixture file with the following content, adjusting values to match your project:

sylius_fixtures:
    suites:
        my_own_company_fixtures:
            fixtures:
                channel:
                    options:
                        custom:
                            default_web_store:
                                enabled: true
                                name: "Web Store"
                                code: "DEFAULT"
                                contact_email: "[email protected]"
                                default_locale: "%locale%"
                                hostname: null
                                locales:
                                    - "en_US"
                                    - "fr_FR"
                                    - "es_ES"
                                    - "de_DE"
                                base_currency: "USD"
                                currencies:
                                    - "USD"
                                    - "EUR"
                invoicing_plugin_shop_billing_data:
                    options:
                        custom:
                            default_web_store:
                                channel_code: 'DEFAULT'
                                company: 'My Company Inc.'
                                country_code: 'US'
                                city: 'My City'
                                postcode: '00000'
                                tax_id: '1234567890'
                                street_address: '1 My Street Address'

Note: Ensure the channel_code used in invoicing_plugin_shop_billing_data matches the code from your channel definition.

3. Load the Fixture Suite

Use the following command to load your fixture suite:

php bin/console sylius:fixture:load my_own_company_fixtures

This will populate your database with the specified channel and corresponding shop billing data.

Tips

  • This setup is ideal for development and staging environments.

  • In production, you may want to manage ShopBillingData manually or via a custom admin interface.

  • You can define multiple billing data entries, one per channel.

Resources

Last updated

Was this helpful?