Filter
rpress_merge_identical_cart_items
On this page
Filters whether adding an identical item raises the quantity of the existing cart line.
Runs in RPRESS_Cart::add(). When true, an item matching an existing line (same size, add-ons and instructions) increases that line's quantity; when false, a separate line is always added.
Parameters#
| Parameter | Type | Description |
|---|---|---|
$value | bool | Whether identical items are merged; true by default. |
$fooditem_id | int | Menu item (fooditem) post ID being added. |
$options | array | Cart options of the item being added. |
Return value#
bool. True to merge into an identical line, false to add a new line.
Example#
function my_merge_identical_cart_items( $merge, $fooditem_id, $options ) {
if ( ! empty( $options['instruction'] ) ) {
return false;
}
return $merge;
}
add_filter( 'rpress_merge_identical_cart_items', 'my_merge_identical_cart_items', 10, 3 );
Source#
Applied in:
includes/cart/class-rpress-cart.php(line 369), inRPRESS_Cart::add()
See also#
Was this page helpful?
