PHP code example of leomoshko / sylius-tierprice-plugin

1. Go to this page and download the library: Download leomoshko/sylius-tierprice-plugin library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

leomoshko / sylius-tierprice-plugin example snippets


return [
    // ...
    Brille24\SyliusTierPricePlugin\Brille24SyliusTierPricePlugin::class => ['all' => true],
];

use Brille24\SyliusTierPricePlugin\Entity\ProductVariantInterface as TierPriceableProductVariantInterface;
use Brille24\SyliusTierPricePlugin\Traits\TierPriceableTrait;
use Sylius\Component\Core\Model\ProductVariant as BaseProductVariant;

class ProductVariant extends BaseProductVariant implements TierPriceableProductVariantInterface
{
    use TierPriceableTrait;

    public function __construct()
    {
        parent::__construct(); // Your constructor here

        $this->initTierPriceableTrait(); // "Constructor" of the trait
    }
}