Created
January 2, 2023 08:09
-
-
Save xlplugins/1b828ae002e74e1afb5095f71b85dd44 to your computer and use it in GitHub Desktop.
offer validation custom
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'wfocu_offer_validation_result', function ( $result, $offer_build ) { | |
if ( false === $result ) { | |
return $result; | |
} | |
$get_order = WFOCU_Core()->data->get_parent_order(); | |
$yourcondition = false; | |
/** | |
* Logic will go here | |
*/ | |
if ( $yourcondition === false ) { | |
WFOCU_Core()->template_loader->invalidation_reason = 'YOUR VALIDAION FAILURE REASON HERE'; | |
WFOCU_Core()->log->log( 'Order #' . WFOCU_WC_Compatibility::get_order_id( $get_order ) . ': YOUR VALIDAION FAILURE REASON HERE' ); | |
return false; | |
} | |
return $result; | |
}, 99, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment