Created
September 10, 2018 10:13
-
-
Save webdados/5b8c0339c327a9d3ba27769ec3a6ea11 to your computer and use it in GitHub Desktop.
Multibanco IfThen - Use specific Entity and Subentity for some specific order details
This file contains 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
<?php | |
// Multibanco IfThen - Use specific Entity and Subentity for some specific order details (Example: depending on the delivery method, or the items bought, the payment must be made with different Ent/Subent) | |
add_filter( 'multibanco_ifthen_base_ent_subent', 'testing_multibanco_ifthen_base_ent_subent', 10, 2 ); | |
function testing_multibanco_ifthen_base_ent_subent( $base, $order ) { | |
//$base is a array with 'ent' and 'subent' keys / values | |
//Test whatever you want here related to the $order object | |
if ( true ) { | |
//Change Entity and Subentity | |
$base['ent'] = '99999'; | |
$base['subent'] = '999'; | |
} else { | |
//Just use the plugin settings | |
} | |
return $base; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment