You are here

public function PriceSplitterInterface::split in Commerce Core 8.2

Splits the given amount across order items.

Parameters

\Drupal\commerce_order\Entity\OrderInterface $order: The order.

\Drupal\commerce_price\Price $amount: The amount.

string $percentage: The percentage used to calculate the amount, as a decimal. For example, '0.2' for 20%. When missing, calculated by comparing the amount to the order subtotal.

Return value

\Drupal\commerce_price\Price[] An array of amounts keyed by order item ID.

1 method overrides PriceSplitterInterface::split()
PriceSplitter::split in modules/order/src/PriceSplitter.php
Splits the given amount across order items.

File

modules/order/src/PriceSplitterInterface.php, line 31

Class

PriceSplitterInterface
Splits price amounts across order items.

Namespace

Drupal\commerce_order

Code

public function split(OrderInterface $order, Price $amount, $percentage = NULL);