I´m trying to call this add_filter inside a Wordpress class. I followed all the rules, but for some reason, it doesn't work.
class WoocommerceController extends BaseController
{
function register(){
add_filter('woocommerce_thankyou_order_received_text', array($this, 'woo_change_order_received_text', 10, 2 ));
}
function woo_change_order_received_text( $str, $order ) {
$new_str = $str . ' We have emailed the purchase receipt to you.';
return $new_str;
}
}
you are passing priority and parameters inside the array that's why its not working add_filter('woocommerce_thankyou_order_received_text', array($this, 'woo_change_order_received_text'), 10, 2 ) write like this