• Resolved bistron

    (@bistron)


    Instead of showing range of price for variable products I use the following code:

    add_filter('woocommerce_variable_price_html', 'custom_variation_price', 10, 2);
    function custom_variation_price( $price, $product ) {
         $price = '';
         $price .= woocommerce_price($product->get_price()/2);
         return $price;
    }

    For my custom purpose I divide the price by 2, but for two products (product_id) I need to display just $product->get_price() without division.

    How can I add 2 product_ids to the code for the exception?

    Thanks

    • This topic was modified 6 years, 11 months ago by bistron.
Viewing 1 replies (of 1 total)
  • Thread Starter bistron

    (@bistron)

    this did the trick

    function custom_variation_price( $price, $product ) {
    global $product;
    $id = $product->get_id();
    if( $product->id == 334 or $product->id == 339) {
         $price = '';
    .....
    • This reply was modified 6 years, 11 months ago by bistron.
Viewing 1 replies (of 1 total)
  • The topic ‘Variable product and range of prices for it’s variations’ is closed to new replies.