Skip to content
Docs
Get RestroPress

Filter

rpress_allow_negative_prices

Updated
On this page

Filters whether negative prices are allowed when saving price meta.

Applied in RPRESS_Register_Meta::sanitize_price(), which sanitises the menu item price and each variable price amount. When it returns false, any price below zero is saved as 0.

Parameters#

ParameterTypeDescription
$allowboolWhether negative prices are allowed, false by default.

Return value#

bool. True to keep negative prices.

Example#

function my_allow_negative_prices( $allow ) {
	return true;
}
add_filter( 'rpress_allow_negative_prices', 'my_allow_negative_prices' );

Source#

Applied in:

  • includes/class-rpress-register-meta.php (line 343), in RPRESS_Register_Meta::sanitize_price()

See also#

Was this page helpful?