WordPress.org

Ready to get started?Download WordPress

Forums

WooCommerce - excelling eCommerce
[resolved] Removing the 2 prices on variable products (3 posts)

  1. dpatisserie
    Member
    Posted 6 months ago #

    Hello,

    I just want to know how can I remove those 2 prices on variable products ?
    I want to keep the old display: "From <price>"

    I already tried this: https://gist.github.com/mikejolley/1600117

    But it's not working at all and I can't find other solution on forums.

    Help please ;)

    Regards,

    (Using WooCommerce version 2.1.4)

    https://wordpress.org/plugins/woocommerce/

  2. dpatisserie
    Member
    Posted 6 months ago #

    Hi,

    This one isn't working also: https://gist.github.com/kloon/8981075

    When I put the code in my child theme, all my site is out. Only blank pages.

    Any idea ? :/

  3. dpatisserie
    Member
    Posted 6 months ago #

    Hello,

    I found how to solve my problem !

    For those who have the same issue:

    /**
    * This code should be added to functions.php of your theme
    **/
    add_filter('woocommerce_variable_price_html', 'custom_variation_price', 10, 2);

    function custom_variation_price( $price, $product ) {

    $price = '';

    if ( !$product->min_variation_price || $product->min_variation_price !== $product->max_variation_price ) $price .= '<span class="from">' . _x('From', 'min_price', 'woocommerce') . ' </span>';

    $price .= woocommerce_price($product->get_price());

    if ( $product->max_variation_price && $product->max_variation_price !== $product->min_variation_price ) {
    //$price .= '<span class="to"> ' . _x('to', 'max_price', 'woocommerce') . ' </span>';

    //$price .= woocommerce_price($product->min_variation_price);
    }

    return $price;
    }

Reply

You must log in to post.

About this Plugin

About this Topic