• Resolved maryamait123

    (@maryamait123)


    Hello, i need to display some user meta in the address tab -> in my acount so i add this code :
    echo $order->get_meta( ‘_billing_mr_ou_mme’);

    but i’m getting a php error

    Fatal error: Uncaught Error: Call to a member function get_meta() on bool in /home/webmuksf/public_html/wp-content/themes/ffsid/woocommerce/myaccount/my-address.php:86

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Tomasz WP Desk

    (@tomaszwp)

    Hello @maryamait123

    I assume you are using the function wc_get_order() which should return a WC_Order object. But it is possible that this function will return false if there is no such order. The error is that you are not checking what you have in the variable $order. You cannot call the method get_meta() if the variable $order does not hold a WC_Order object.

    If you want to retrieve such value from user profile then you should use another function:
    get_user_meta( get_current_user_id(), 'billing_mr_ou_mme', true )

    The get_meta() method is a method from the WooCommerce plugin – not our plugin.

    Please note that our FREE plugin places the billing fields in the My Account > Addresses section without additional codes.
    Display On settings

    Plugin Support Tomasz WP Desk

    (@tomaszwp)

    I am marking this topic as resolved as we have not received any new replies.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘i get error when displaying the user meta’ is closed to new replies.