Provides time based special pricing for Sylius.

Installs: 16 339

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 4

Forks: 2

Open Issues: 2



Build Status

This plugin provides a configuration for prices that are just active within a certain date range. So if you want to change the price for a product between the 1st May and the 1st of April, this plugin is for you.


  1. Require the plugin

    composer require brille24/sylius-special-price-plugin
  2. Register the plugin in your bundles.php

    return [
        Brille24\SyliusSpecialPricePlugin\Brille24SyliusSpecialPricePlugin::class => ['all' => true],
  3. Import plugin config

        - { resource: "@Brille24SyliusSpecialPricePlugin/Resources/config/config.yml" }
  4. Add migrations

    1. Copy migrations from tests/Application/migration to your desired spot for migrations.
  5. Override ProductVariant entity

    1. Write new class which will use ProductVariantSpecialPricableTrait and implement ProductVariantSpecialPricableInterface
    2. Override the models class in config
                      model: Brille24\SyliusSpecialPricePlugin\Entity\ProductVariant
  6. Add mapping and validation

    1. Mapping
      <!-- ProductVariant.orm.xml -->
      <doctrine-mapping xmlns="">
          <mapped-superclass name="Your\Name\Space\ProductVariant" table="sylius_product_variant">
              <one-to-many field="channelSpecialPricings"
                           mapped-by="productVariant" orphan-removal="true">
    2. Validation
      <!-- ProductVariant.xml -->
      <constraint-mapping xmlns="">
          <class name="Your\Name\Space\ProductVariant">
                  <option name="groups">sylius</option>
  7. Override SyliusAdminBundle/ProductVariant/Tab/_details.html.twig

    Add this:

    <div class="ui segment">
        {% include 'Brille24SyliusSpecialPricePlugin::_specialPrice.html.twig' with {
            'form': form.channelSpecialPricings
        } %}
  8. Update the database schema

    bin/console doctrine:schema:update --force

Running the test server

From the plugin root directory, run the following commands:

(cd tests/Application && yarn install)
(cd tests/Application && yarn build)
(cd tests/Application && bin/console assets:install --symlink)

(cd tests/Application && bin/console doctrine:database:create)
(cd tests/Application && bin/console doctrine:schema:update --force)
(cd tests/Application && bin/console sylius:fixtures:load)

(cd tests/Application && bin/console server:start)


In order to run the phpspec tests you need to run the command vendor/bin/phpspec run In order to run the phpunit tests you need to run the command vendor/bin/phpunit In order to run the behat tests you need to run the command vendor/bin/behat