You are here

function hook_uc_stock_adjusted in Ubercart 8.4

Same name and namespace in other branches
  1. 6.2 docs/hooks.php \hook_uc_stock_adjusted()
  2. 7.3 uc_stock/uc_stock.api.php \hook_uc_stock_adjusted()

Allows modules to take action when a stock level is changed.

Parameters

string $sku: The SKU whose stock level is being changed.

int $stock: The stock level before the adjustment.

int $qty: The amount by which the stock level was changed.

1 invocation of hook_uc_stock_adjusted()
uc_stock_adjust in uc_stock/uc_stock.module
Adjusts the product stock level by a set amount.

File

uc_stock/uc_stock.api.php, line 23
Hooks provided by the Stock module.

Code

function hook_uc_stock_adjusted($sku, $stock, $qty) {
  $params = [
    'sku' => $sku,
    'stock' => $stock,
    'qty' => $qty,
  ];
  $to = "stock-manager@example.com";
  \Drupal::service('plugin.manager.mail')
    ->mail('uc_stock', 'stock-adjusted', $to, uc_store_mail_recipient_langcode($to), $params, uc_store_email_from());
}