Skip to content
Docs
Get RestroPress

Filter

rpress_block_storefront_price_text

Updated
On this page

Filters the plain-text menu price shown by the block storefront.

Applied to the formatted price of a single-price menu item after tax display rules are applied. Not applied to variable-price items, which show a price range. The default is the currency-formatted price decoded to plain text.

Parameters#

ParameterTypeDescription
$textstringFormatted price as plain text.
$fooditem_idintMenu item (fooditem) ID.
$pricefloatNumeric price after tax adjustment.

Return value#

string. Price text.

Example#

add_filter( 'rpress_block_storefront_price_text', 'my_storefront_price_text', 10, 3 );
function my_storefront_price_text( $text, $fooditem_id, $price ) {
	return $price <= 0 ? __( 'Free', 'my-plugin' ) : $text;
}

Source#

Applied in:

  • includes/features/block-storefront/functions.php (line 129), in rpress_block_storefront_price_text()
Was this page helpful?