You are here

function uc_stock_set in Ubercart 7.3

Same name and namespace in other branches
  1. 8.4 uc_stock/uc_stock.module \uc_stock_set()
  2. 6.2 uc_stock/uc_stock.module \uc_stock_set()

Sets the product stock level.

Parameters

$sku: The product SKU of the stock level to set.

$qty: The number of items in stock.

1 call to uc_stock_set()
UbercartStockTestCase::testProductStock in uc_stock/tests/uc_stock.test

File

uc_stock/uc_stock.module, line 165
Allow ubercart products to have stock levels associated with their SKU

Code

function uc_stock_set($sku, $qty) {
  db_update('uc_product_stock')
    ->fields(array(
    'stock' => $qty,
  ))
    ->condition('sku', $sku)
    ->execute();
}