/** * {@inheritdoc} */ public function execute(PromotionSubjectInterface $subject, array $configuration, PromotionInterface $promotion) { if (!$subject instanceof OrderInterface) { throw new UnexpectedTypeException($subject, 'Sylius\\Component\\Core\\Model\\OrderInterface'); } $adjustment = $this->repository->createNew(); $adjustment->setAmount(-$subject->getShippingTotal() * $configuration['percentage']); $adjustment->setLabel(OrderInterface::PROMOTION_ADJUSTMENT); $adjustment->setDescription($promotion->getDescription()); $subject->addAdjustment($adjustment); }