I want to add a specific rule if the order uses a specific gateway for a plugin.
They have a public function for orders, is it possible I add some code to the function if the order used mycred gateway as well?
Here is the public function.
/*
* @param int
* @return none
*/
if ($order_id){
if (is_object($order_id)){
$order_id = (isset($order_id->ID)) ? $order_id->ID : 0;
}
$this->referral_refuse($order_id, $this->source_type);
}
}```
2
Answers
I can not format the code with comment, So I posted here.
Btw, I found a filter of the plugin, I am not sure which is the better way,
Those are the filters, I am not sure which one should I use, but I tried both of the 2 filters, when checkout it shows internal error, I think the code may have some error.
The flowing code is what I have tried and shows internal error when checkout:
Based on this tutorial you can calculate the order payment method via:
Therefore, you could check if "Mycred" (or whatever title you gave it) equals that calculation and only then proceed with the function: