• Resolved emzdesign

    (@emzdesign)


    I’m working on a website and in their functions file is a function to display prices excluding VAT.

    A piece of code to display this is

    woocommerce_price($variation->get_price_excluding_tax())

    These have since been deprecated and I’ve tried to replace the code with this:

    wc_price($variation->wc_get_price_excluding_tax())

    But that doesn’t seem to work.

    The output of the original code includes “WC_Product::” before “get_price_exluding_tax” and this still remains once I’ve changed the code, but I don’t think this is needed anymore. Trouble is I’m not sure where this is coming from or how to replace it.

    Any help is appreciated.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter emzdesign

    (@emzdesign)

    I’ve managed to change the code to the following, and it still shows the price correctly, but I’m still getting the Deprecated error.

    wc_get_price_excluding_tax($variation, array('price' => $variation->get_price_excluding_tax()))

    The error I get if I change the second instance of get_price_excluding tax to wc_get_price_excluding_tax I get the following error:

    Fatal error: Uncaught Error: Call to undefined method WC_Product_Variation::wc_get_price_excluding_tax()

    Any help would be appreciated.

    Plugin Support mouli a11n

    (@mouli)

    As you are comfortable with coding yourself and have questions, I would recommend that you join the WooCommerce Slack Community (https://woocommerceslack.herokuapp.com), or the Advanced WooCommerce Facebook group (https://www.facebook.com/groups/advanced.woocommerce).?

    I hope that helps you to figure it out.
    Feel free to get back to us if you have further questions.

    Plugin Support Thu P. a11n

    (@thup90)

    Hi there,

    I hope you found the previous reply helpful. We haven’t heard back from you in a while, so I’m going to mark this as resolved – if you have any further questions, you can start a new thread.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Changing Deprecated Functions’ is closed to new replies.