public function OrderItem::getData in Commerce Core 8.2
Gets an order item data value with the given key.
Used to store temporary data during order processing (i.e. checkout).
Parameters
string $key: The key.
mixed $default: The default value.
Return value
mixed The value.
Overrides OrderItemInterface::getData
File
- modules/
order/ src/ Entity/ OrderItem.php, line 281
Class
- OrderItem
- Defines the order item entity class.
Namespace
Drupal\commerce_order\EntityCode
public function getData($key, $default = NULL) {
$data = [];
if (!$this
->get('data')
->isEmpty()) {
$data = $this
->get('data')
->first()
->getValue();
}
return isset($data[$key]) ? $data[$key] : $default;
}