Released on 2025-July-24
- Added functionality to restrict one order per customer per raffle
- Added functionality to customize the restrict based on different order fields
Code used in the demo video
add_filter( 'filter_args_restrict_order_raffle', 'custom_function', 20, 3);
function custom_function( $args, $data, $type ){
$first_name = '';
if( $type == 'block'){ //this is a block checkout
$first_name = sanitize_text_field( $data->get_billing_first_name() );
}else{ //legacy checkout
$first_name = sanitize_text_field( $data['billing_first_name'] );
}
$args = array(
'status' => array('wc-processing', 'wc-on-hold', 'wc-completed'),
'limit' => -1,
'order' => 'DESC',
'billing_first_name' => $first_name,
);
return $args;
}