You are here

public function ProraterInterface::prorateOrderItem in Commerce Recurring Framework 8

Prorates the given order item.

When needed, the plugin can use separate logic for recurring and initial order items by looking at the order item type:

if (in_array($order_item
  ->bundle(), commerce_recurring_order_item_types())) {

  // This is a recurring order item.
}
else {

  // This is an initial order item.
}

Parameters

\Drupal\commerce_order\Entity\OrderItemInterface $order_item: The order item.

\Drupal\commerce_recurring\BillingPeriod $billing_period: The partial billing period.

\Drupal\commerce_recurring\BillingPeriod $full_billing_period: The full billing period.

Return value

\Drupal\commerce_price\Price The prorated price.

1 method overrides ProraterInterface::prorateOrderItem()
ProraterBase::prorateOrderItem in src/Plugin/Commerce/Prorater/ProraterBase.php
Prorates the given order item.

File

src/Plugin/Commerce/Prorater/ProraterInterface.php, line 45

Class

ProraterInterface
Modifies unit prices to reflect partial billing periods.

Namespace

Drupal\commerce_recurring\Plugin\Commerce\Prorater

Code

public function prorateOrderItem(OrderItemInterface $order_item, BillingPeriod $billing_period, BillingPeriod $full_billing_period);