You are here

public function ProductVariation::getOrderItemTypeId in Commerce Core 8.2

Gets the purchasable entity's order item type ID.

Used for finding/creating the appropriate order item when purchasing a product (adding it to an order).

Return value

string The order item type ID.

Overrides PurchasableEntityInterface::getOrderItemTypeId

File

modules/product/src/Entity/ProductVariation.php, line 260

Class

ProductVariation
Defines the product variation entity class.

Namespace

Drupal\commerce_product\Entity

Code

public function getOrderItemTypeId() {

  // The order item type is a bundle-level setting.
  $type_storage = $this
    ->entityTypeManager()
    ->getStorage('commerce_product_variation_type');
  $type_entity = $type_storage
    ->load($this
    ->bundle());
  return $type_entity
    ->getOrderItemTypeId();
}