• Resolved RashaMatt

    (@rashamatt)


    With TPT v4.0.3 activated, the output from the “woocommerce_get_price_html” filter is displayed briefly on product pages within “span.tiered-pricing-dynamic-price-wrapper”, but that span then gets immediately overwritten by the unfiltered woo price html.

    With TPT v3.6.2, this does not happen (and should not).

    My site is now reverted to TPT v3.6.2, so it is not currently a suitable site for you to test this issue.

    The page I need help with: [log in to see the link]

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author WP Developer

    (@bycrik)

    Hello,

    Please update the plugin to the version 4.0.4

    Thread Starter RashaMatt

    (@rashamatt)

    Unfortunately v4.0.4 exhibits the same issue as v4.0.3 ??

    Plugin Author WP Developer

    (@bycrik)

    Sorry to hear that.

    Would you please provide some more information about the issue? Some screenshots and links will be useful.

    Thanks

    Thread Starter RashaMatt

    (@rashamatt)

    I have this Woo filter active to customize the Product Price text:

    //Add text after price to certain products
    function themeprefix_custom_price_message( $price ) { 
      global $post;
      if( is_object($post) ) {
        $id = $post->ID;
        $price .= ' '. product_unit_pricing_text_fn( $id, 'per' ); 
      }
      return $price;
    }
    
    add_filter( 'woocommerce_get_price_html', 'themeprefix_custom_price_message' );

    Using TPT versions up to v3.6.2 this works as expected, and the site displays Product Prices processed by the above filter.

    With TPT versions after v3.6.2, the behavior is different – when a product page first loads, I do see the correct (filtered) Product Price text as expected… BUT then after about 0.3 seconds that span in the page is replaced with an unfiltered version of the Product Price text (i.e., as if the filter did not exist).

    Plugin Author WP Developer

    (@bycrik)

    Hello,

    The plugin wraps the price to make it handled by JS. When quantity is changed – the JS script update the price with actual tier price. JS script does not know anything about the PHP filter you add. It just replaces everything in the container with the actual price.

    There are two option I see here:

    1. Try to increase the priority of your hook to add the unit pricing text after the tiered pricing wraps the price into a container, so it will not be included in the container – as a result, it will not be overridden: add_filter( ‘woocommerce_get_price_html’, ‘themeprefix_custom_price_message’, 99999999 );

    2. Disable price wrapping by the tiered pricing table (this will disable the price being dynamic – JS script will not update any price when quantity is changed): add_filter(‘tiered_pricing_table/frontend/wrap_price’, ‘__return_false’);

    Thread Starter RashaMatt

    (@rashamatt)

    Increasing the priority of my woocommerce_get_price_html hook has fixed the issue – thanks! ??

    Plugin Author WP Developer

    (@bycrik)

    Thanks for confirming.

    I’m marking this thread as resolved. Feel free to open a new one if you have any issues with the plugin.

    If you’re happy with the plugin, we’d appreciate if you could rate it here, on wp.org: https://www.ads-software.com/support/plugin/tier-pricing-table/reviews/#new-post

    Thanks!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘v4.0.3 breaks “woocommerce_get_price_html” filter’ is closed to new replies.