PHP code example of setono / sylius-cost-price-plugin

1. Go to this page and download the library: Download setono/sylius-cost-price-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/ */

    

setono / sylius-cost-price-plugin example snippets



// config/bundles.php

return [
    // ...
    
    Setono\SyliusCostPricePlugin\SetonoSyliusCostPricePlugin::class => ['all' => true],
    
    // ...
];



// src/Entity/ProductVariant.php

declare(strict_types=1);

namespace App\Entity;

use Setono\SyliusCostPricePlugin\Model\CostPriceAwareInterface;
use Setono\SyliusCostPricePlugin\Model\ProductVariantTrait as CostPriceProductVariantTrait;
use Sylius\Component\Core\Model\Product as BaseProduct;

/**
 * @ORM\Entity
 * @ORM\Table(name="sylius_product_variant")
 */
class ProductVariant extends BaseProduct implements CostPriceAwareInterface
{
    use CostPriceProductVariantTrait;
    
    // ...
}