I am trying to retrieve post id under custom_fields_validation() function but I am receiving the following
error: Trying to get property of non-object on line 116
add_action('woocommerce_add_to_cart_validation','custom_fields_validation'), 10, 3 );
public static function custom_fields_validation()
{
global $post;
if(isRecurring($post->ID)){
if ( empty( $_POST['inputday']) ){
wc_add_notice( __( 'Please select field 1;', 'woocommerce' ), 'error' );
return false;
}
if ( empty( $_POST['inputtime'] )){
wc_add_notice( __( 'Please select field 2;', 'woocommerce' ), 'error' );
return false;
}
}
return true;
}