shopp_product_set_inventory()

turn on/off inventory tracking, set stock level, and stock keeping unit (SKU) on a product, variant, or addon.

shopp_product_set_inventory ( $product, $flag, $settings )

@param int $product (required) The Product id to setup the inventory tracking on.
@param bool $flag (optional default:false) true for on, false for off. Turns on or off the inventory tracking on the product.  If false, settings are ignored.
@param array $settings array of inventory settings (stock => int, sku => sting)
@return bool true on success, false on failure

Description

turn on/off inventory tracking, set stock level, and stock keeping unit (SKU) on a product, variant, or addon.

This function uses shopp_product_variant_set_stock() to set the stock level on a product, variant, or addon.

Example

// turn on inventory tracking on product 2, 
// and set the stock level and SKU
shopp_product_variant_set_inventory ( 2, true, array('stock'=>15, 'sku'=>'MYPRODUCTSKU'));

See Also

You must be logged in to post a comment.

© Ingenesis Limited. Shopp™ is a registered trademark of Ingenesis Limited.

Skip to toolbar