shopp_cartitem_stock

filters the cart item stock override.

add_filter( 'shopp_cartitem_stock', [callback] )

@param int|bool $stock when false, this value is ignored entirely.  When an integer, this value overrides the stock value of an item in the cart.
@param Item $Item the cart item object the stock is being checked on.

Description

filters the cart item stock override.

When the stock figure is checked on a particular item in the cart, implementing this filter will allow you to override the database stock value of the item. This might be useful if you track your inventory figures outside of Shopp.

Example

// register filter callback
add_filter('shopp_cartitem_stock', 'my_stock_filter', 10, 2);

// create filter function
function my_stock_filter( $stock, $Item ) {
    // override all cart stock checks allowing up to 10
    return 10;
}

See Also

You must be logged in to post a comment.

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

Skip to toolbar