public function TestAdjustmentProcessor::process in Commerce Core 8.2
Processes an order.
Parameters
\Drupal\commerce_order\Entity\OrderInterface $order: The order.
Overrides OrderProcessorInterface::process
File
- modules/
order/ tests/ modules/ commerce_order_test/ src/ TestAdjustmentProcessor.php, line 18
Class
- TestAdjustmentProcessor
- Adds order and order item adjustments for testing purposes.
Namespace
Drupal\commerce_order_testCode
public function process(OrderInterface $order) {
foreach ($order
->getItems() as $order_item) {
// Add adjustment for PriceCalculatorTest.
if ($order
->getEmail() == 'user2@example.com') {
$order_item
->addAdjustment(new Adjustment([
'type' => 'test_adjustment_type',
'label' => '$2.00 fee',
'amount' => new Price('2.00', 'USD'),
]));
}
}
}