Filter
rpress_pre_add_to_cart_contents
On this page
Filters the cart contents before a new item is added.
Runs in RPRESS_Cart::add() right after rpress_pre_add_to_cart. The value is the cart's current contents, and the filtered array is used as the base the new line is added to.
Parameters#
| Parameter | Type | Description |
|---|---|---|
$value | array | Current cart contents. |
Return value#
array. The cart contents to add to.
Example#
function my_pre_add_to_cart_contents( $contents ) {
return is_array( $contents ) ? $contents : array();
}
add_filter( 'rpress_pre_add_to_cart_contents', 'my_pre_add_to_cart_contents', 10, 1 );
Source#
Applied in:
includes/cart/class-rpress-cart.php(line 357), inRPRESS_Cart::add()
See also#
Was this page helpful?
