Skip to content
Docs
Get RestroPress

Filter

rpress_get_fooditem_button_behavior

Updated
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#

ParameterTypeDescription
$button_behaviorstringButton behavior, for example add_to_cart.
$IDintMenu 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), in RPRESS_Fooditem::get_button_behavior()
Was this page helpful?