Filter
rpress_cart_has_discounts
On this page
Filters whether the cart has any discounts applied.
Runs in RPRESS_Cart::has_discounts() after the active discount codes have been checked. The result is cached on the cart for the rest of the request.
Parameters#
| Parameter | Type | Description |
|---|---|---|
$has_discounts | bool | True when at least one discount code is active. |
Return value#
bool. Whether the cart is treated as having discounts.
Example#
function my_cart_has_discounts( $has_discounts ) {
return $has_discounts;
}
add_filter( 'rpress_cart_has_discounts', 'my_cart_has_discounts', 10, 1 );
Notes#
The result is stored in the cart object, so later changes to the discounts in the same request are not reflected.
Source#
Applied in:
includes/cart/class-rpress-cart.php(line 313), inRPRESS_Cart::has_discounts()
See also#
Was this page helpful?
