Woocommerce Xero function not working – "Error: "Using $this…"

I have the function below in the woocommerce xero plugin.

     * @return string
    public function get_name() {
        return apply_filters( 'woocommerce_xero_contact_name', $this->name, $this );

I need to change

'woocommerce_xero_contact_name', $this->name, $this );

to this

'woocommerce_xero_contact_name', $this->billing_company, $this );

when I tried to write a function for my functions.php I keep getting Error: “Using $this when not in object context” which I don’t understand.

my function looks like this at the moment;

public function xero_contact_name_1( $this ) {

    return $this->billing_company;
add_filter( 'woocommerce_xero_contact_name', 'xero_contact_name_1' );

Any ideas what I’m doing wrong?


Read more here: Woocommerce Xero function not working – "Error: "Using $this…"

Leave a Reply

Your email address will not be published. Required fields are marked *