# How to redefine CalculatedPrice?

**URL:** https://forum.shopware.com/t/how-to-redefine-calculatedprice/72999
**Category:** Programming (EN)
**Created:** [25. Februar 2021 um 11:35 UTC](https://forum.shopware.com/t/how-to-redefine-calculatedprice/72999 "2021-02-25T11:35:41Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![DouglasMurrel](https://avatars.discourse-cdn.com/v4/letter/d/a88e57/32.png) [@DouglasMurrel](https://forum.shopware.com/u/DouglasMurrel)
#### Post date: [25. Februar 2021 um 11:35 UTC](https://forum.shopware.com/t/how-to-redefine-calculatedprice/72999/1 "2021-02-25T11:35:41Z")

</div>

&nbsp;

I’m trying to write plugin in Shopware6, it must add some custom values (like deposit) to Product line item. So I wrote my class

```
class DepositCalculatedPrice extends CalculatedPrice
{
    /** @var float $deposit */
    protected $deposit;

    public function __construct(
        float $unitPrice,
        float $totalPrice,
        CalculatedTaxCollection $calculatedTaxes,
        CalculatedTaxCollection $calculatedTaxesNoDeposit,
        TaxRuleCollection $taxRules,
        int $quantity = 1,
        ?ReferencePrice $referencePrice = null,
        ?ListPrice $listPrice = null,
        float $deposit = 0,
    ) {
        parent::__construct(
            $unitPrice,
            $totalPrice,
            $calculatedTaxes,
            $taxRules,
            $quantity,
            $referencePrice,
            $listPrice
        );
        $this->deposit = $deposit;
    }

    public function getDeposit(): float
    {
        return FloatComparator::cast($this->deposit);
    }
}

```

Then I use it in my Calculator and then in my PriceProcessor. All goes well until I try to submit my order, but then Shopware6 checks field definintion classes in `Checkout/Order/Aggregate/OrderLineItem/OrderLineItemDefinition.php`, and it checks Price json field against CalculatedPrice, not DepositCalculatedPrice. So is there any way to resolve it? Maybe I can use somewhere some descendant of `OrderLineItemDefinition.php`? Or make it not checking field definitions?
