Change variation price format from range ($150-$200) to "From: $100" and round price decimal
The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday. If you have problems with registration ask help on contact us page pleaseIf you not got email within 24~36 business hours, firstly check your spam box, and if no any email from the support there - back to the forum and read answer here. DO NOT ANSWER ON EMAILS [noreply@pluginus.net] FROM THE FORUM!! Emails are just for your info, all answers should be published only here.
The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday.
Quote from omrimon@gmail.com on March 18, 2025, 03:18Hey there,
I'd like to change the variation price format from range (example: $150-$200) to "From: $100" and also round price decimals of simple and variable products to $.0
Hey there,
I'd like to change the variation price format from range (example: $150-$200) to"From: $100" and also round price decimals of simple and variable products to $.0
Quote from Pablo Borysenco on March 18, 2025, 11:25Hello
Our plugin is a currency converter and does not affect the price display template.
To round prices - https://currency-switcher.com/hook/woocs_raw_woocommerce_price/
Hello
Our plugin is a currency converter and does not affect the price display template.
To round prices - https://currency-switcher.com/hook/woocs_raw_woocommerce_price/
Quote from omrimon@gmail.com on March 18, 2025, 20:54I already have the code to change the variation price format and round prices but the currency code (USD /CAD) goes missing on variable products.
See example here: https://parafunalia.ca/product-category/skydiving-helmets
Here's the code I'm using
//Change variation price format from range ($100 - $200) to "From:"
add_filter( 'woocommerce_get_price_html', 'change_variable_products_price_display', 10, 2 );
function change_variable_products_price_display( $price, $product ) {// Only for variable products type
if( ! $product->is_type('variable') ) return $price;$prices = $product->get_variation_prices( true );
if ( empty( $prices['price'] ) )
return apply_filters( 'woocommerce_variable_empty_price_html', '', $product );$min_price = current( $prices['price'] );
$max_price = end( $prices['price'] );
$prefix_html = '<span class="price-prefix">' . __('From ') . '</span>';$prefix = $min_price !== $max_price ? $prefix_html : ''; // HERE the prefix
return apply_filters( 'woocommerce_variable_price_html', $prefix . wc_price( $min_price ) . $product->get_price_suffix(), $product );
}
//Round raw price to .00
add_filter('woocs_raw_woocommerce_price', function($price) {
return round((float)$price );
});//Round Variation price to .00
//
add_filter('woocs_woocommerce_variation_prices', function($price) {
return round((float)$price );
});
I already have the code to change the variation price format and round prices but the currency code (USD /CAD) goes missing on variable products.
See example here: https://parafunalia.ca/product-category/skydiving-helmets
Here's the code I'm using
//Change variation price format from range ($100 - $200) to"From:"
add_filter( 'woocommerce_get_price_html', 'change_variable_products_price_display', 10, 2 );
function change_variable_products_price_display( $price, $product ) {
// Only for variable products type
if( ! $product->is_type('variable') ) return $price;
$prices = $product->get_variation_prices( true );
if ( empty( $prices['price'] ) )
return apply_filters( 'woocommerce_variable_empty_price_html', '', $product );
$min_price = current( $prices['price'] );
$max_price = end( $prices['price'] );
$prefix_html = '<span class="price-prefix">' . __('From ') . '</span>';
$prefix = $min_price !== $max_price ? $prefix_html : ''; // HERE the prefix
return apply_filters( 'woocommerce_variable_price_html', $prefix . wc_price( $min_price ) . $product->get_price_suffix(), $product );
}
//Round raw price to .00
add_filter('woocs_raw_woocommerce_price', function($price) {
return round((float)$price );
});
//Round Variation price to .00
//
add_filter('woocs_woocommerce_variation_prices', function($price) {
return round((float)$price );
});
Quote from Pablo Borysenco on March 19, 2025, 11:03Hello
Ok! You should hire a developer to customize your third-party code.
Hello
Ok! You should hire a developer to customize your third-party code.
Quote from omrimon@gmail.com on March 19, 2025, 23:04Ok! how much do you charge...?
Ok! how much do you charge...?
Quote from omrimon@gmail.com on March 20, 2025, 01:44Also, how to round decimals of product options added with Extra Product Options plugin which is supported by this plugin?
See example product here: https://parafunalia.ca/product/vertical-suits-viper-swoop-shorts/?v=5435c69ed3bc
Also, how to round decimals of product options added with Extra Product Options plugin which is supported by this plugin?
See example product here: https://parafunalia.ca/product/vertical-suits-viper-swoop-shorts/?v=5435c69ed3bc
Quote from Pablo Borysenco on March 20, 2025, 11:19Hello
I added email in private data
how to round decimals of product options added with Extra Product Options pluginĀ - In this case, it is better to write to the author of this third-party plugin.
Hello
I added email in private data
how to round decimals of product options added with Extra Product Options pluginĀ - In this case, it is better to write to the author of this third-party plugin.