public function DisabledStockEvents::stockEvent in Commerce Stock 8
A stock event with transaction details.
The stock event gets both the details about the type of the event and the transaction it should create. It can simply create the transaction from the details provided, add logic to check if the transaction is to be created or override the details provided before creating the transaction.
Parameters
\Drupal\commerce\Context $context: The context containing the customer & store.
\Drupal\commerce\PurchasableEntityInterface $entity: The purchasable entity.
int $stockEvent: The event ID that's responsible for the transaction.
int $quantity: The quantity.
\Drupal\commerce_stock\StockLocationInterface $location: The stock location.
int $transaction_type: The transaction type ID.
array $metadata: Holds all the optional values those are:
- related_oid: related order.
- related_uid: related user.
- data: Serialized data array holding a message.
Return value
int Return the ID of the transaction or FALSE if no transaction created.
Overrides StockEventsInterface::stockEvent
File
- src/
Plugin/ StockEvents/ DisabledStockEvents.php, line 25
Class
- DisabledStockEvents
- Core Stock Events.
Namespace
Drupal\commerce_stock\Plugin\StockEventsCode
public function stockEvent(Context $context, PurchasableEntityInterface $entity, $stockEvent, $quantity, StockLocationInterface $location, $transaction_type, array $metadata) {
// This does nothing.
return NULL;
}