setono / sylius-toggle-vat-plugin
Let customers decide to show prices with or without VAT in your Sylius store
Fund package maintenance!
Setono
Installs: 3
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:sylius-plugin
Requires
- php: >=8.1
- setono/composite-compiler-pass: ^1.2
- sylius/channel: ^1.0
- sylius/core: ^1.0
- sylius/core-bundle: ^1.0
- sylius/taxation: ^1.0
- symfony/config: ^5.4 || ^6.4 || ^7.0
- symfony/dependency-injection: ^5.4 || ^6.4 || ^7.0
- symfony/http-foundation: ^5.4 || ^6.4 || ^7.0
- symfony/http-kernel: ^5.4 || ^6.4 || ^7.0
- symfony/routing: ^5.4 || ^6.4 || ^7.0
- twig/twig: ^2.0 || ^3.0
- webmozart/assert: ^1.11
Requires (Dev)
- api-platform/core: ^2.7.18
- babdev/pagerfanta-bundle: ^3.8
- behat/behat: ^3.19
- doctrine/doctrine-bundle: ^2.11
- infection/infection: ^0.27.11
- jms/serializer-bundle: ^4.2
- lexik/jwt-authentication-bundle: ^2.17
- matthiasnoback/symfony-dependency-injection-test: ^5.1 || ^6.1
- phpspec/prophecy-phpunit: ^2.3
- phpunit/phpunit: ^9.6.23
- psalm/plugin-phpunit: ^0.18.4
- setono/code-quality-pack: ^2.9
- setono/doctrine-orm-trait: ^1.2
- shipmonk/composer-dependency-analyser: ^1.8.2
- sylius/sylius: ~1.12.19
- symfony/debug-bundle: ^5.4 || ^6.4 || ^7.0
- symfony/dotenv: ^5.4 || ^6.4 || ^7.0
- symfony/intl: ^5.4 || ^6.4 || ^7.0
- symfony/property-info: ^5.4 || ^6.4 || ^7.0
- symfony/serializer: ^5.4 || ^6.4 || ^7.0
- symfony/web-profiler-bundle: ^5.4 || ^6.4 || ^7.0
- symfony/webpack-encore-bundle: ^1.17.2
- willdurand/negotiation: ^3.1
This package is auto-updated.
Last update: 2025-05-09 09:43:17 UTC
README
Let customers decide to show prices with or without VAT in your Sylius store.
Installation
composer require setono/sylius-toggle-vat-plugin
Import routing
# config/routes/setono_sylius_toggle_vat.yaml setono_sylius_toggle_vat: resource: "@SetonoSyliusToggleVatPlugin/Resources/config/routes.yaml"
or if your app doesn't use locales:
# config/routes/setono_sylius_toggle_vat.yaml setono_sylius_toggle_vat: resource: "@SetonoSyliusToggleVatPlugin/Resources/config/routes_no_locale.yaml"
Default configuration
setono_sylius_toggle_vat: # Whether to display prices with VAT or not by default display_with_vat: true # Name of the cookie used to store the user's VAT choice cookie_name: sstv_display_with_vat # By default, the plugin will decorate Sylius's PriceHelper (Sylius\Bundle\CoreBundle\Templating\Helper\PriceHelper) # to add the VAT logic. If you want to disable this and do your own custom implementation, set this to false decorate_price_helper: true
Insert VAT toggler
By default, the VAT toggler is injected using the Sylius UI event system and the event sylius.shop.layout.topbar
,
however, you can inject it yourself calling the Twig function sstv_vat_toggler()
anywhere in your templates.
VAT context
The plugin uses the Setono\SyliusToggleVatPlugin\Context\VatContextInterface
to deduce whether to show prices
with our without VAT. You can create your own VAT context by implementing that interface.