Skip to content
Docs
Get RestroPress

Filter

rpress_is_discount_min_met

Updated
On this page

Filters whether the cart meets the minimum amount required by a discount.

Runs at the end of RPRESS_Discount::is_min_price_met(), which is part of the discount validation chain. The value starts as true when the discountable cart subtotal is at least the discount's minimum price. Returning a different value changes whether the discount is accepted. If the minimum was not met, the session error message has already been set before this filter runs, so overriding the result to true does not clear that message.

Available since RestroPress 1.0.6.

Parameters#

ParameterTypeDescription
$returnboolWhether the minimum cart amount is met.
$IDintDiscount ID.

Return value#

bool. True if the minimum cart amount is considered met.

Example#

function my_waive_min_for_discount( $return, $discount_id ) {
	// Ignore the minimum order amount for discount 123.
	if ( 123 === (int) $discount_id ) {
		return true;
	}
	return $return;
}
add_filter( 'rpress_is_discount_min_met', 'my_waive_min_for_discount', 10, 2 );

Source#

Applied in:

  • includes/class-rpress-discount.php (line 1483), in RPRESS_Discount::is_min_price_met()

See also#

Was this page helpful?