Filter
rpress_get_fooditem_button_behavior
On this page
Filters the purchase button behavior of a menu item.
Runs at the end of RPRESS_Fooditem::get_button_behavior(). The value comes from the _rpress_button_behavior meta and is forced to add_to_cart when empty or when the shop does not support buy now.
Parameters#
| Parameter | Type | Description |
|---|---|---|
$button_behavior | string | Button behavior, for example add_to_cart. |
$ID | int | Menu item ID. |
Return value#
string. The button behavior.
Example#
function my_button_behavior( $behavior, $fooditem_id ) {
return 'add_to_cart';
}
add_filter( 'rpress_get_fooditem_button_behavior', 'my_button_behavior', 10, 2 );
Source#
Applied in:
includes/class-rpress-fooditem.php(line 429), inRPRESS_Fooditem::get_button_behavior()
Was this page helpful?
