Filter
rpress_insert_discount
On this page
Filters the discount meta before a new discount is inserted.
Runs in RPRESS_Discount::add() when a new discount is created, after the meta array is built from the arguments. Keys include code, name, status, uses, max_uses, amount, start, expiration, type, min_price, product_reqs, product_condition, excluded_products, category_reqs, excluded_category, is_not_global and is_single_use.
Available since RestroPress 1.0.6.
Parameters#
| Parameter | Type | Description |
|---|---|---|
$meta | array | Discount meta to be stored. |
Return value#
array. The discount meta to store.
Example#
function my_insert_discount( $meta ) {
$meta['code'] = strtoupper( $meta['code'] );
return $meta;
}
add_filter( 'rpress_insert_discount', 'my_insert_discount' );
Notes#
The source docblock lists a discount ID parameter, but only the meta array is passed.
Source#
Applied in:
includes/class-rpress-discount.php(line 1178), inRPRESS_Discount::add()
See also#
Was this page helpful?
