• Resolved tpo

    (@topod)


    Hello,

    is there any possibility to set custom display of prices on composite product page and also in selectbox via hooks?

    I have set in functions.php to display custom prices (with discounts etc.), but they don’t show for composite products (only the regular price is displayed there). For other types of products they work fine.

    The hooks for my customized prices I have set up now are as follows:

    woocommerce_product_get_price
    woocommerce_product_get_regular_price
    woocommerce_product_variation_get_regular_price
    woocommerce_product_variation_get_price
    woocommerce_product_variation_get_price
    woocommerce_product_variation_get_regular_price
    woocommerce_price_variation_price
    woocommerce_variation_prices_regular_price

    My composite product consists of 3 variants. If I open these variants on a separate page of the parent product, the prices are correct. However, if these variants are opened within the composite product, only regular prices are displayed.

    What hook or other option could I use if I wanted to adjust prices for a composite product as well?

    Thanks!

    • This topic was modified 2 years, 3 months ago by tpo.
    • This topic was modified 2 years, 2 months ago by tpo.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter tpo

    (@topod)

    I was able to edit the price to display correctly by editing line 2780 in wpc-composite-products.php and instead of:

    $_price_html = $product->get_price_html();

    I wrote this:

    if ($product->get_regular_price() <> ($product->get_regular_price() * get_price_multiplier())) {
        $_price_html = "<del>" . wc_price($product->get_regular_price()) . "</del>&nbsp;<bdi class=\"sale\"><strong>" . wc_price($product->get_regular_price() * get_price_multiplier()) . "</strong></bdi>";
      } else {
        $_price_html = wc_price($product->get_regular_price());
    }

    However, I am aware that this change will be overwritten after the next update of the plugin, so my question is whether such a modification can be made via functions.php so that it will remain after the plugin update.

    Thanks!

    Plugin Author WPClever

    (@wpclever)

    Hi @topod

    Please update our plugin to the latest version 5.3.3 then you can use the filter hook ‘wooco_product_original_price_html’ at this position https://www.screencast.com/t/xwLUPL5CIh instead of modifying the code.

    Thread Starter tpo

    (@topod)

    Thank you!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Custom composite variations price via hooks / functions.php’ is closed to new replies.