shopp_product_addon_set_inventory()

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

shopp_product_addon_set_inventory ( $addon, $flag, $settings )

@param int/Price $addon (required) The priceline id to setup the inventory tracking on, or the Price object to change.  If Price object is specified, the object will be returned, but not saved to the database.
@param bool $flag (optional default:false) true for on, false for off. Turns on or off the inventory tracking on the addon.  If false, settings are ignored.
@param array $settings array of inventory settings (stock => int, sku => sting)
@return bool/Price false on failure, true if Price saved, else the modified Price object.

Description

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

This function uses shopp_product_variant_set_inventory().

Example

// Shipped Addon "Leather Case" for product 5
$Case = shopp_product_variant(array('product'=>5, 'option'=>array('Accessories' => 'Leather Case' )));

// turn on inventory, set stock level and sku
shopp_product_addon_set_inventory($Case->id, true, array('stock'=>10, 'sku'=>'LTHRCS1'));

See Also

You must be logged in to post a comment.

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

Skip to toolbar