Home Forums WoodMart support forum Hide “to” price not working

Hide “to” price not working

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #482683

    musab
    Participant

    Hi, I want to hide “to price” on the product page, I enabled the option: Hide “to” price in: Theme Settings > Shop > Variable Product, but the “from to Price” still appears on the product page.

    #482696

    Luke Nielsen
    Keymaster

    Hello,

    Make sure that you have cleared the cache after making changes in Theme Settings. If after the clearing cache, you have the same issue, please send me access to the admin dashboard so I will investigate the issue on your side.

    Kind Regards

    #482697

    musab
    Participant

    I cleared the cash, re-imported the demo, tried “default Settings”nothing works.

    #482699

    Luke Nielsen
    Keymaster

    Hello,

    Seems that the “WOOCS” plugin affects a little bit the HTML structure of the price so as a result the CSS code is not working. Could you please disable it, clear the cache and recheck the issue?

    Kind Regards

    #482700

    musab
    Participant

    after disabling it, the Hide “to” price function worked, but the plugin is necessary to me as I’m using a Flutter app for my website, it’s needed for the currency switcher. is there any solution :)?

    #482715

    musab
    Participant

    Hi, solved it by adding this code to my functions.php of my child theme:

    //Hide Price Range for WooCommerce Variable Products
    add_filter( ‘woocommerce_variable_sale_price_html’,
    ‘lw_variable_product_price’, 10, 2 );
    add_filter( ‘woocommerce_variable_price_html’,
    ‘lw_variable_product_price’, 10, 2 );

    function lw_variable_product_price( $v_price, $v_product ) {

    // Product Price
    $prod_prices = array( $v_product->get_variation_price( ‘min’, true ),
    $v_product->get_variation_price( ‘max’, true ) );
    $prod_price = $prod_prices[0]!==$prod_prices[1] ? sprintf(__(‘%1$s’, ‘woocommerce’),
    wc_price( $prod_prices[0] ) ) : wc_price( $prod_prices[0] );

    // Regular Price
    $regular_prices = array( $v_product->get_variation_regular_price( ‘min’, true ),
    $v_product->get_variation_regular_price( ‘max’, true ) );
    sort( $regular_prices );

    if ( $prod_price !== $regular_price ) {
    $prod_price = ‘‘.$regular_price.$v_product->get_price_suffix() . ‘ ‘ .
    $prod_price . $v_product->get_price_suffix() . ‘
    ‘;
    }
    return $prod_price;
    }

    #482716

    musab
    Participant

    lite code:

    add_filter( ‘woocommerce_variable_sale_price_html’, ‘lw_variable_product_price’, 10, 2 );
    add_filter( ‘woocommerce_variable_price_html’, ‘lw_variable_product_price’, 10, 2 );

    function lw_variable_product_price( $v_price, $v_product ) {
    // Product Price
    $prod_price = wc_price( $v_product->get_variation_price( ‘min’, true ) );

    // Regular Price
    $regular_price = wc_price( $v_product->get_variation_regular_price( ‘min’, true ) );

    if ( $prod_price !== $regular_price ) {
    $prod_price = ‘‘ . $regular_price . $v_product->get_price_suffix() . ‘ ‘ .
    $prod_price . $v_product->get_price_suffix() . ‘
    ‘;
    }

    return $prod_price;
    }

    #482825

    Luke Nielsen
    Keymaster

    Hello,

    Great! I am glad that you have sorted it out.

    Always remember that you can reach out to us with any questions you may have.

    We wish you a splendid day!

    Kind Regards

Viewing 8 posts - 1 through 8 (of 8 total)

The topic ‘Hide “to” price not working’ is closed to new replies.