PHPackages                             ecoco/sylius-base-price-plugin - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. ecoco/sylius-base-price-plugin

ActiveSylius-plugin[Utility &amp; Helpers](/categories/utility)

ecoco/sylius-base-price-plugin
==============================

Sylius base price plugin will show product base price next to its price and in cart

v1.3.1(4y ago)2219MITPHPPHP ^7.3

Since Feb 4Pushed 4y ago4 watchersCompare

[ Source](https://github.com/ecoco/SyliusBasePricePlugin)[ Packagist](https://packagist.org/packages/ecoco/sylius-base-price-plugin)[ RSS](/packages/ecoco-sylius-base-price-plugin/feed)WikiDiscussions main Synced today

READMEChangelog (10)Dependencies (31)Versions (15)Used By (0)

Ecocode Sylius Base Price Plugin
================================

[](#ecocode-sylius-base-price-plugin)

[![Latest Version on Packagist](https://camo.githubusercontent.com/bc9a9c2a912a55619f3ed91ea64c2386fd1bdf0e1099eeee83545264879deda2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f65636f636f2f73796c6975732d626173652d70726963652d706c7567696e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ecoco/sylius-base-price-plugin)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE)[![Code Coverage](https://camo.githubusercontent.com/6d768d3251c4ca1e254f3a846fb22e6aba115c1fa05347d3c863de39926441f7/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f65636f636f2f53796c697573426173655072696365506c7567696e2f6261646765732f636f7665726167652e706e673f623d6d61696e)](https://scrutinizer-ci.com/g/ecoco/SyliusBasePricePlugin/?branch=main)[![Build Status](https://camo.githubusercontent.com/bf8a1ec283c9696d712fb2a06aeedacaf2c96bbf7c5be9d58814985d11baee75/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f65636f636f2f53796c697573426173655072696365506c7567696e2f6261646765732f6275696c642e706e673f623d6d61696e)](https://scrutinizer-ci.com/g/ecoco/SyliusBasePricePlugin/build-status/main)

[![SymfonyInsight](https://camo.githubusercontent.com/857b413102810b97be864c2f1ab632e497bb6a5bbb778ba09a7e66af08432787/68747470733a2f2f696e73696768742e73796d666f6e792e636f6d2f70726f6a656374732f63616564363131612d323839312d343635332d386332322d3036643936633231306336662f6269672e737667)](https://insight.symfony.com/projects/caed611a-2891-4653-8c22-06d96c210c6f)

Plugin that calculates and shows product base price

Documentation
-------------

[](#documentation)

Sylius Base Price Plugin allows you to add extra information to your shop about product base price. After installation you will need to set up product variable mass or volume or other unit. This value will be used to calculate base unit price and will show up in product detail page and cart.

Features
--------

[](#features)

- Installs base\_price\_unit and base\_price\_value columns in sylius\_product\_variant table.
- "Base Price" tab in admin product variant page
- Base price display in product detail page
- Base price display in cart for each product

Installation
------------

[](#installation)

### Download and install

[](#download-and-install)

```
composer require ecoco/sylius-base-price-plugin
```

### Enable plugin

[](#enable-plugin)

\*this step is done automatically by symfony.

Register the plugin by adding it to your `config/bundles.php` file

```
return [
    // ...
    Ecocode\SyliusBasePricePlugin\EcocodeSyliusBasePricePlugin::class => ['all' => true],
];
```

### Configure

[](#configure)

You need to copy config file to project:

[config/packages/ecocode\_sylius\_base\_price\_plugin.yaml](data/config/packages/ecocode_sylius_base_price_plugin.yaml)

```
cp vendor/ecoco/sylius-base-price-plugin/data/config/packages/ecocode_sylius_base_price_plugin.yaml config/packages/ecocode_sylius_base_price_plugin.yaml
```

### Advanced configuration

[](#advanced-configuration)

If you want to have more control over what metrics are visible and how it will be converted then you should update:

`ecocode_sylius_base_price:` (uncomment from above)

Its default values are defined in `src/Resources/config/config.yaml`

### Extend `ProductVariant` entity

[](#extend-productvariant-entity)

Add trait and interface to existing entity.

[src/Entity/Product/ProductVariant.php](data/src/Entity/Product/ProductVariant.php)

```
cp vendor/ecoco/sylius-base-price-plugin/data/src/Entity/Product/ProductVariant.php src/Entity/Product/ProductVariant.php
```

### Run migration

[](#run-migration)

```
bin/console doctrine:migrations:diff
bin/console doctrine:migrations:migrate
```

or update schema without defining migration

```
bin/console -e test doctrine:schema:update --dump-sql
bin/console -e test doctrine:schema:update --dump-sql --force
```

### Clear cache

[](#clear-cache)

```
bin/console cache:clear
```

Usage
-----

[](#usage)

##### 1. Select product unit

[](#1-select-product-unit)

[![Screenshot edit product variant unit type](docs/images/admin-dropdown.jpg)](docs/images/admin-dropdown.jpg)

##### 2. Set product unit value

[](#2-set-product-unit-value)

[![Screenshot edit product variant base price](docs/images/admin.jpg)](docs/images/admin.jpg)

##### 3. See it in product detail page

[](#3-see-it-in-product-detail-page)

[![Screenshot see product detail page](docs/images/product-detail-page.jpg)](docs/images/product-detail-page.jpg)

##### 4. See it in cart

[](#4-see-it-in-cart)

[![Screenshot see in cart](docs/images/cart.jpg)](docs/images/cart.jpg)

Testing
=======

[](#testing)

Using docker-compose (suggested)
--------------------------------

[](#using-docker-compose-suggested)

First you will need to edit `edit behat.yml.dist` and uncomment lines related to docker-compose.

Then you can boot it up. Prepare database and run tests.

```
docker-compose up -d
docker-compose exec php bash -c "XDEBUG_MODE=coverage composer test"
#docker-compose exec php console doctrine:database:drop --force
#docker-compose exec php console doctrine:database:create
docker-compose exec php console doctrine:schema:update --force
docker-compose exec php console sylius:fixtures:load
docker-compose exec php behat
docker-compose down

```

Using docker
============

[](#using-docker)

Using this test method you will not be able to test behat so easily

```
docker build . -t sylius-base-price-plugin
docker run -v $(pwd)/build:/var/www/html/build -e XDEBUG_MODE=coverage sylius-base-price-plugin composer test

```

Locally (complex)
=================

[](#locally-complex)

1. You will need to have database running. You can use locally installed one or run it using docker.

    ```
    docker run -d --rm -p 3306:3306 -e MYSQL_ROOT_PASSWORD=test -e MYSQL_DATABASE=sylius -e MYSQL_USER=app -e MYSQL_PASSWORD=test mariadb:10.5.9

    ```
2. Then edit and make sure database configuration is correct:

Edit tests/Application/.env.test file. And add database configuration there

```
DATABASE_URL=mysql://root:root@127.0.0.1/sylius

# if you're running mariadb
DATABASE_URL=mysql://root:root@0.0.0.0/sylius?serverVersion=mariadb-10.3.25

```

3. Export test env (then commands dont require `-e test`)

```
export APP_ENV=test
```

Installation
------------

[](#installation-1)

Continue with setup

```
composer install
cd tests/Application
yarn install
yarn run gulp
bin/console assets:install public -e test
bin/console cache:clear -e test
#bin/console doctrine:database:drop --force -e test
#bin/console doctrine:database:create -e test
bin/console doctrine:schema:create -e test
bin/console sylius:fixtures:load -e test
bin/console doctrine:schema:update --dump-sql --force -e test

# If you want to develop something this is one way of starting dev server.
# Later on we will use symfony server because it can handle https way easier.
#bin/console server:run 127.0.0.1:8080 -d public -e test
```

Come back to root directory

```
cd ../../
```

Then you should be able to run phpunit and other static code analysis checks.

PhpUnit
-------

[](#phpunit)

```
vendor/bin/phpunit
```

Static code analysis
--------------------

[](#static-code-analysis)

### Psalm

[](#psalm)

```
vendor/bin/psalm
```

### PHPStan

[](#phpstan)

```
vendor/bin/phpstan analyse -c phpstan.neon -l max src/
```

Behat (JS scenarios)
--------------------

[](#behat-js-scenarios)

```
1. [Install Symfony CLI command](https://symfony.com/download).

2. Start Chrome (all other chrome sessions needs to be closed first):

 Headless
 ```bash
 google-chrome-stable --enable-automation --disable-background-networking --no-default-browser-check --no-first-run --disable-popup-blocking --disable-default-apps --allow-insecure-localhost --disable-translate --disable-extensions --no-sandbox --enable-features=Metal --headless --remote-debugging-port=9222 --window-size=2880,1800 --proxy-server='direct://' --proxy-bypass-list='*' http://127.0.0.1
 ```

 Normal
 ```bash
 google-chrome-stable --enable-automation --disable-background-networking --no-default-browser-check --no-first-run --disable-popup-blocking --disable-default-apps --allow-insecure-localhost --disable-translate --disable-extensions --no-sandbox --enable-features=Metal --remote-debugging-port=9222 --window-size=2880,1800 --proxy-server='direct://' --proxy-bypass-list='*' http://127.0.0.1
 ```

3. Install SSL certificates (only once needed) and run test application's webserver on `127.0.0.1:8080`:

 ```bash
 symfony server:ca:install
 APP_ENV=test symfony server:start --port=8080 --dir=tests/Application/public --daemon
 ```

4. Run Behat:

 Uncomment local configuration in `behat.yml.dist` (and comment out docker-compose one)

 ```bash
 vendor/bin/behat --strict --tags="@javascript"
 ```

```

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~14 days

Recently: every ~20 days

Total

13

Last Release

1800d ago

Major Versions

v0.0.7 → v1.0.02021-02-04

### Community

Maintainers

![](https://www.gravatar.com/avatar/8fac9b5b8134ce972e4652dc10133ea632c4287f7e62ef65cad3ae9c05d6cdbe?d=identicon)[wormhit](/maintainers/wormhit)

---

Top Contributors

[![andrejsstepanovs](https://avatars.githubusercontent.com/u/324553?v=4)](https://github.com/andrejsstepanovs "andrejsstepanovs (5 commits)")

---

Tags

syliussylius-pluginecoco

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Psalm

Type Coverage Yes

### Embed Badge

![Health badge](/badges/ecoco-sylius-base-price-plugin/health.svg)

```
[![Health](https://phpackages.com/badges/ecoco-sylius-base-price-plugin/health.svg)](https://phpackages.com/packages/ecoco-sylius-base-price-plugin)
```

###  Alternatives

[sylius/refund-plugin

Plugin provides basic refunds functionality for Sylius application.

701.8M20](/packages/sylius-refund-plugin)[stefandoorn/sitemap-plugin

Sitemap Plugin for Sylius

841.1M1](/packages/stefandoorn-sitemap-plugin)[monsieurbiz/sylius-rich-editor-plugin

A Rich Editor plugin for Sylius.

75416.2k6](/packages/monsieurbiz-sylius-rich-editor-plugin)[odiseoteam/sylius-vendor-plugin

Vendor plugin for Sylius. Add Vendor (Brand) to your products

6068.4k1](/packages/odiseoteam-sylius-vendor-plugin)[synolia/sylius-scheduler-command-plugin

Scheduler Command Plugin.

35389.6k](/packages/synolia-sylius-scheduler-command-plugin)[stefandoorn/google-tag-manager-plugin

Google Tag Manager plugin for Sylius.

23292.9k2](/packages/stefandoorn-google-tag-manager-plugin)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
