You are here

public function StockUpdateInterface::createTransaction in Commerce Stock 8

Create a stock transaction.

Parameters

\Drupal\commerce\PurchasableEntityInterface $entity: The purchasable entity.

int $location_id: The location ID.

string $zone: The zone.

float $quantity: Tbe quantity.

float $unit_cost: The unit cost.

string $currency_code: The currency code.

int $transaction_type_id: The transaction type ID.

array $metadata: Holds all the optional values those are:

  • related_tid: related transaction.
  • related_oid: related order.
  • related_uid: related user.
  • data: Serialized data array.

Return value

int Return the ID of the transaction.

2 methods override StockUpdateInterface::createTransaction()
AlwaysInStock::createTransaction in src/AlwaysInStock.php
Create a stock transaction.
LocalStockUpdater::createTransaction in modules/local_storage/src/LocalStockUpdater.php
Create a stock transaction.

File

src/StockUpdateInterface.php, line 39

Class

StockUpdateInterface
Defines a common interface for writing stock.

Namespace

Drupal\commerce_stock

Code

public function createTransaction(PurchasableEntityInterface $entity, $location_id, $zone, $quantity, $unit_cost, $currency_code, $transaction_type_id, array $metadata);