Filter
rpress_get_price_option_name
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#
| Parameter | Type | Description |
|---|---|---|
$price_name | string | Name of the price option, or an empty string. |
$fooditem_id | int | ID of the menu item. |
$payment_id | int | Optional order ID for context, 0 when not given. |
$price_id | int | ID 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), inrpress_get_price_option_name()
See also#
Was this page helpful?
