Skip to content
Docs
Get RestroPress

Filter

rpress_get_price_option_name

Updated
On this page

Filters the name of a variable price option.

Runs in rpress_get_price_option_name after the name is read from the menu item's variable prices. An empty string is returned when the price ID does not exist. Note that the order of the last two arguments differs from the function signature, which takes the price ID before the payment ID.

Parameters#

ParameterTypeDescription
$price_namestringName of the price option, or an empty string.
$fooditem_idintID of the menu item.
$payment_idintOptional order ID for context, 0 when not given.
$price_idintID of the price option.

Return value#

string. The price option name.

Example#

function my_price_option_name( $price_name, $fooditem_id, $payment_id, $price_id ) {
	if ( '' === $price_name ) {
		return __( 'Standard', 'my-plugin' );
	}
	return $price_name;
}
add_filter( 'rpress_get_price_option_name', 'my_price_option_name', 10, 4 );

Notes#

The argument order is ($price_name, $fooditem_id, $payment_id, $price_id), while rpress_get_price_option_name() takes ($fooditem_id, $price_id, $payment_id).

Source#

Applied in:

  • includes/fooditem-functions.php (line 269), in rpress_get_price_option_name()

See also#

Was this page helpful?