OrderItemVariationType.php in Commerce Core 8.2
File
modules/product/src/Plugin/Commerce/Condition/OrderItemVariationType.php
View source
<?php
namespace Drupal\commerce_product\Plugin\Commerce\Condition;
use Drupal\commerce\Plugin\Commerce\Condition\ConditionBase;
use Drupal\Core\Entity\EntityInterface;
class OrderItemVariationType extends ConditionBase {
use VariationTypeTrait;
public function evaluate(EntityInterface $entity) {
$this
->assertEntity($entity);
$order_item = $entity;
$purchased_entity = $order_item
->getPurchasedEntity();
if (!$purchased_entity || $purchased_entity
->getEntityTypeId() != 'commerce_product_variation') {
return FALSE;
}
return in_array($purchased_entity
->bundle(), $this->configuration['variation_types']);
}
}