PluginUs.Net - Business Tools for WooCommerce and WordPress

[realize your idea - make your dreams come true]

Support Forum

You need to log-in to create request (topic) to the support

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 please
If 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.

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

 

 

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/

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 );
});

Hello

Ok! You should hire a developer to customize your third-party code.

Ok! how much do you charge...?

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

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.