New Landing How can we help? Themeforest Theme Support Dante How to display one price only under products in shop

Viewing 3 posts - 1 through 3 (of 3 total)
  • Posted in: Dante
  • #221542
    solidsn2004
    Member
    Post count: 208

    Hi,

    Most of my products in the shop have various prices according to the amount you can choose (I have added attributes and variations).
    You can’t select only one product, but only in bulk.

    Is there a way to show individual item price instead of the product range? (see attachments)

    Thanks in advance.

    #221589
    solidsn2004
    Member
    Post count: 208

    I don’t know why but images didn’t upload properly. I upload them again here.

    Attachments:
    You must be logged in to view attached files.
    #221836
    David Martin – Support
    Moderator
    Post count: 20834

    Hi,

    You can use this to show the lowest from price for that product, you will need to activate your child theme and inside the file called functions.php please copy and paste this:

    // Use WC 2.0 variable price format
    	add_filter( 'woocommerce_variable_sale_price_html', 'wc_wc20_variation_price_format', 10, 2 );
    	add_filter( 'woocommerce_variable_price_html', 'wc_wc20_variation_price_format', 10, 2 );
    	function wc_wc20_variation_price_format( $price, $product ) {
    	$min_price = $product->get_variation_price( 'min', true );
    	$max_price = $product->get_variation_price( 'max', true );
    	if ($min_price != $max_price){
    	$price = sprintf( __( '<span class="">From %1$s</span>', 'woocommerce' ), wc_price( $min_price ) );
    	return $price;
    	} else {
    	$price = sprintf( __( '<span class="">%1$s</span>', 'woocommerce' ), wc_price( $min_price ) );
    	return $price;
    	}
    	}

    Thanks,
    David.

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

You must be logged in and have valid license to reply to this topic.

License required for one of the following items
Login and Registration Log in · Register