Skip to content
Docs
Get RestroPress

Action

rpress_setup_discount

Updated
On this page

Fires after the RPRESS_Discount object is set up.

Fires at the end of RPRESS_Discount::setup_discount(), after all properties are populated and before the method returns true. Extensions can use it to load their own data onto the object.

Available since RestroPress 1.0.6.

Parameters#

ParameterTypeDescription
$discount_objectRPRESS_DiscountThe populated discount object.
$discountWP_PostThe discount post.

Example#

function my_setup_discount( $discount_object, $discount ) {
	$discount_object->my_note = get_post_meta( $discount->ID, '_my_discount_note', true );
}
add_action( 'rpress_setup_discount', 'my_setup_discount', 10, 2 );

Source#

Fired from:

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

See also#

Was this page helpful?