Support » Plugin: WooPrice Calculator » Problem with woocommerce_get_price_html filter

  • Resolved Damian Gora


    Great plugin!

    I have a little problem with a get_price_html() method of a WC_Product class. You use woocommerce_get_price_html filter to manipulate an output. At the beginning of the filter_woocommerce_get_price_html method you get product ID by a function get_the_ID().The second parameter of this filter is $instance (instance of the current WC_Product class). Why did not you use it to get a product ID?

    I use a method get_price_html() inside Ajax request directly on a WC_Product object (outside WordPress Loop) and a function get_the_ID() does not work.

    get_price_html method
    woocommerce_get_price_html filter

    Any help appreciated.

    • This topic was modified 3 years, 7 months ago by Damian Gora.
Viewing 1 replies (of 1 total)
  • Plugin Author Altos



    You’ve right, this will be fixed in next releases.

    I think you can replace in the function “filter_woocommerce_get_price_html“,

    $productId = $instance->get_id();

    Change also:

    function filter_woocommerce_get_price_html($price, $include){


    add_filter('woocommerce_get_price_html', array($this, 'filter_woocommerce_get_price_html'), 10, 2);


Viewing 1 replies (of 1 total)
  • The topic ‘Problem with woocommerce_get_price_html filter’ is closed to new replies.