Action
rpress_after_set_cart_item_quantity
On this page
Fires after the quantity of a cart line has been updated.
Runs after the cart has been saved in RPRESS_Cart::set_item_quantity() and RPRESS_Cart::set_item_quantity_by_key(). The contents argument is the full updated cart.
Parameters#
| Parameter | Type | Description |
|---|---|---|
$fooditem_id | int | Menu item (fooditem) post ID of the updated line. |
$quantity | int | The new quantity. |
$options | array | Options passed with the update, such as instruction, addon_items and price_id. |
$arg4 | array | The updated cart contents. |
Example#
function my_after_set_quantity( $fooditem_id, $quantity, $options, $contents ) {
error_log( sprintf( 'Menu item %d quantity set to %d', $fooditem_id, $quantity ) );
}
add_action( 'rpress_after_set_cart_item_quantity', 'my_after_set_quantity', 10, 4 );
Notes#
In set_item_quantity_by_key() the menu item ID is read back from the updated line.
Source#
Fired from:
includes/cart/class-rpress-cart.php(line 814), inRPRESS_Cart::set_item_quantity()includes/cart/class-rpress-cart.php(line 852), inRPRESS_Cart::set_item_quantity_by_key()
See also#
Was this page helpful?
