getPurchasePriceAmount example

$constraints['isNet'] = RuleConstraints::bool(true);

        return $constraints;
    }

    /** * @throws CartException * @throws UnsupportedOperatorException */
    private function matchPurchasePriceCondition(LineItem $lineItem): bool
    {
        $purchasePriceAmount = $this->getPurchasePriceAmount($lineItem);

        return RuleComparison::numeric($purchasePriceAmount$this->amount, $this->operator);
    }

    private function getPurchasePriceAmount(LineItem $lineItem): ?float
    {
        $purchasePricePayload = $lineItem->getPayloadValue('purchasePrices');
        if (!$purchasePricePayload) {
            return null;
        }
        $purchasePrice = json_decode((string) $purchasePricePayload, true, 512, \JSON_THROW_ON_ERROR);

        
Home | Imprint | This part of the site doesn't use cookies.