PromotionNotFoundError example


                [
                    \sprintf(self::SHIPPING_METHOD_CHANGED_ERROR_CONTENT, 'Express', 'Standard'),
                    \sprintf(self::PAYMENT_METHOD_CHANGED_ERROR_CONTENT, 'Invoice', 'Paid in advance'),
                ],
                true,
            ],
            // Promotion not found             [
                new ErrorCollection(
                    [
                        new PromotionNotFoundError('tn-08'),
                    ]
                ),
                [
                    self::PROMOTION_NOT_FOUND_ERROR_CONTENT,
                ],
            ],
            // Product out of stock             [
                new ErrorCollection(
                    [
                        new ProductOutOfStockError('product id', 'Car'),
                    ]
use Shopware\Core\Framework\Log\Package;

#[Package('buyers-experience')] trait PromotionCartInformationTrait
{
    /** * Adds a new error to the cart if the promotion for * the provided code was not found as active and valid promotion. */
    private function addPromotionNotFoundError(string $code, Cart $cart): void
    {
        $cart->addErrors(new PromotionNotFoundError($code));
    }

    /** * Adds a new error to the cart if the promotion has been found * but somehow is not eligible for the current cart. */
    private function addPromotionNotEligibleError(string $name, Cart $cart): void
    {
        $cart->addErrors(new PromotionNotEligibleError($name));
    }

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