You are here

protected function TaxTypeBase::resolveCustomerProfile in Commerce Core 8.2

Resolves the customer profile for the given order item.

Parameters

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

Return value

\Drupal\profile\Entity\ProfileInterface|null The customer profile, or NULL if not yet known.

1 call to TaxTypeBase::resolveCustomerProfile()
LocalTaxTypeBase::apply in modules/tax/src/Plugin/Commerce/TaxType/LocalTaxTypeBase.php
Applies the tax type to the given order.

File

modules/tax/src/Plugin/Commerce/TaxType/TaxTypeBase.php, line 243

Class

TaxTypeBase
Provides the base class for tax types.

Namespace

Drupal\commerce_tax\Plugin\Commerce\TaxType

Code

protected function resolveCustomerProfile(OrderItemInterface $order_item) {
  $order = $order_item
    ->getOrder();
  $customer_profile = $this
    ->buildCustomerProfile($order);

  // Allow the customer profile to be altered, per order item.
  $event = new CustomerProfileEvent($customer_profile, $order_item);
  $this->eventDispatcher
    ->dispatch(TaxEvents::CUSTOMER_PROFILE, $event);
  $customer_profile = $event
    ->getCustomerProfile();
  return $customer_profile;
}