Skip to content

Instantly share code, notes, and snippets.

@xlplugins
Created January 2, 2023 08:09
Show Gist options
  • Save xlplugins/1b828ae002e74e1afb5095f71b85dd44 to your computer and use it in GitHub Desktop.
Save xlplugins/1b828ae002e74e1afb5095f71b85dd44 to your computer and use it in GitHub Desktop.
offer validation custom
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