class ProductVariationTaxCodeResolver in Drupal Commerce Connector for AvaTax 8
Resolves tax code based on product variation value.
Hierarchy
- class \Drupal\commerce_avatax\Resolver\ProductVariationTaxCodeResolver implements TaxCodeResolverInterface
Expanded class hierarchy of ProductVariationTaxCodeResolver
1 string reference to 'ProductVariationTaxCodeResolver'
1 service uses ProductVariationTaxCodeResolver
File
- src/
Resolver/ ProductVariationTaxCodeResolver.php, line 11
Namespace
Drupal\commerce_avatax\ResolverView source
class ProductVariationTaxCodeResolver implements TaxCodeResolverInterface {
/**
* {@inheritdoc}
*/
public function resolve(OrderItemInterface $order_item) {
$purchased_entity = $order_item
->getPurchasedEntity();
if ($purchased_entity instanceof ProductVariationInterface) {
if (!$purchased_entity
->get('avatax_tax_code')
->isEmpty()) {
return $purchased_entity
->get('avatax_tax_code')->value;
}
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ProductVariationTaxCodeResolver:: |
public | function |
Resolves the tax code of a given order item.. Overrides TaxCodeResolverInterface:: |