Wrong regular price when disabling variation
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 gilamar on January 3, 2021, 00:18Hello guys,
I'm running this function to display only the highest price on variation:
function wpglorify_variation_price_format( $price, $product ) {
// Main Price
$prices = array( $product->get_variation_price( 'max', true ), $product->get_variation_price( 'min', true ) );
$price = $prices[0] !== $prices[1] ? sprintf( __( '%1$s', 'woocommerce' ), wc_price( $prices[0] ) ) : wc_price( $prices[0] );// Sale Price
$prices = array( $product->get_variation_regular_price( 'max', true ), $product->get_variation_regular_price( 'min', true ) );
sort( $prices );
$saleprice = $prices[0] !== $prices[1] ? sprintf( __( '%1$s', 'woocommerce' ), wc_price( $prices[0] ) ) : wc_price( $prices[0] );if ( $price !== $saleprice ) {
$price = '<del>' . $saleprice . $product->get_price_suffix() . '</del> <ins>' . $price . $product->get_price_suffix() . '</ins>';
}
return $price;
}On base currency everything works well (USD)
But when changing to other currency, regular price (sale price looks correct) is incorrect,
On this pic: https://imgur.com/a/bL3KY2y you can see the price in Mexican Peso which is ridiculously high.
Thanks in advance!
Hello guys,
I'm running this function to display only the highest price on variation:
function wpglorify_variation_price_format( $price, $product ) {
// Main Price
$prices = array( $product->get_variation_price( 'max', true ), $product->get_variation_price( 'min', true ) );
$price = $prices[0] !== $prices[1] ? sprintf( __( '%1$s', 'woocommerce' ), wc_price( $prices[0] ) ) : wc_price( $prices[0] );// Sale Price
$prices = array( $product->get_variation_regular_price( 'max', true ), $product->get_variation_regular_price( 'min', true ) );
sort( $prices );
$saleprice = $prices[0] !== $prices[1] ? sprintf( __( '%1$s', 'woocommerce' ), wc_price( $prices[0] ) ) : wc_price( $prices[0] );if ( $price !== $saleprice ) {
$price = '<del>' . $saleprice . $product->get_price_suffix() . '</del> <ins>' . $price . $product->get_price_suffix() . '</ins>';
}
return $price;
}
On base currency everything works well (USD)
But when changing to other currency, regular price (sale price looks correct) is incorrect,
On this pic: https://imgur.com/a/bL3KY2y you can see the price in Mexican Peso which is ridiculously high.
Thanks in advance!
Quote from gilamar on January 3, 2021, 11:00Update:
After setting "Is multiple allowed" to "NO" problem solved but I need to be able to checkout with customer currency which i can't with these settings.
BTW I'm using Sober Theme and licensed WOOCS plugin.
Regards,
Update:
After setting"Is multiple allowed" to"NO" problem solved but I need to be able to checkout with customer currency which i can't with these settings.
BTW I'm using Sober Theme and licensed WOOCS plugin.
Regards,
Quote from Pablo Borysenco on January 4, 2021, 11:18Hello
Paste your license key here - https://c2n.me/43SC6rb.png -> https://c2n.me/42HBIt7.png
Hello
Paste your license key here - https://c2n.me/43SC6rb.png -> https://c2n.me/42HBIt7.png
Quote from gilamar on January 4, 2021, 16:48Just added requested info
Just added requested info
Quote from Pablo Borysenco on January 5, 2021, 11:10Hello
you need to customize this third party code
Try to paste this code :
if (class_exists('WOOCS')) {
global $WOOCS;
if ($WOOCS->is_multiple_allowed) {
$currrent = $WOOCS->current_currency;
if ($currrent != $WOOCS->default_currency) {
$currencies = $WOOCS->get_currencies();
$rate = $currencies[$currrent]['rate'];
$prices[0] = $prices[0]/ $rate;
}
}
}Paste here - https://c2n.me/4ashg5q.png
Hello
you need to customize this third party code
Try to paste this code :
if (class_exists('WOOCS')) {
global $WOOCS;
if ($WOOCS->is_multiple_allowed) {
$currrent = $WOOCS->current_currency;
if ($currrent != $WOOCS->default_currency) {
$currencies = $WOOCS->get_currencies();
$rate = $currencies[$currrent]['rate'];
$prices[0] = $prices[0]/ $rate;
}
}
}
Paste here - https://c2n.me/4ashg5q.png
Quote from gilamar on January 5, 2021, 16:13Still same... This is how code look inside functions.php, maybe I didn't paste is correctly...
function wpglorify_variation_price_format( $price, $product ) {
// Main Price
$prices = array( $product->get_variation_price( 'max', true ), $product->get_variation_price( 'min', true ) );
if (class_exists('WOOCS')) {
global $WOOCS;
if ($WOOCS->is_multiple_allowed) {
$currrent = $WOOCS->current_currency;
if ($currrent != $WOOCS->default_currency) {
$currencies = $WOOCS->get_currencies();
$rate = $currencies[$currrent]['rate'];
$prices[0] = $prices[0]/ $rate;
}
}
}
$price = $prices[0] !== $prices[1] ? sprintf( __( '%1$s', 'woocommerce' ), wc_price( $prices[0] ) ) : wc_price( $prices[0] );// Sale Price
$prices = array( $product->get_variation_regular_price( 'max', true ), $product->get_variation_regular_price( 'min', true ) );
sort( $prices );
$saleprice = $prices[0] !== $prices[1] ? sprintf( __( '%1$s', 'woocommerce' ), wc_price( $prices[0] ) ) : wc_price( $prices[0] );if ( $price !== $saleprice ) {
$price = '<del>' . $saleprice . $product->get_price_suffix() . '</del> <ins>' . $price . $product->get_price_suffix() . '</ins>';
}
return $price;
}
Still same... This is how code look inside functions.php, maybe I didn't paste is correctly...
function wpglorify_variation_price_format( $price, $product ) {
// Main Price
$prices = array( $product->get_variation_price( 'max', true ), $product->get_variation_price( 'min', true ) );
if (class_exists('WOOCS')) {
global $WOOCS;
if ($WOOCS->is_multiple_allowed) {
$currrent = $WOOCS->current_currency;
if ($currrent != $WOOCS->default_currency) {
$currencies = $WOOCS->get_currencies();
$rate = $currencies[$currrent]['rate'];
$prices[0] = $prices[0]/ $rate;
}
}
}
$price = $prices[0] !== $prices[1] ? sprintf( __( '%1$s', 'woocommerce' ), wc_price( $prices[0] ) ) : wc_price( $prices[0] );// Sale Price
$prices = array( $product->get_variation_regular_price( 'max', true ), $product->get_variation_regular_price( 'min', true ) );
sort( $prices );
$saleprice = $prices[0] !== $prices[1] ? sprintf( __( '%1$s', 'woocommerce' ), wc_price( $prices[0] ) ) : wc_price( $prices[0] );if ( $price !== $saleprice ) {
$price = '<del>' . $saleprice . $product->get_price_suffix() . '</del> <ins>' . $price . $product->get_price_suffix() . '</ins>';
}
return $price;
}
Quote from Pablo Borysenco on January 6, 2021, 11:17Hello
Ok! Try to add the same code here - https://c2n.me/4asRRDH.png
Hello
Ok! Try to add the same code here - https://c2n.me/4asRRDH.png
Quote from gilamar on January 6, 2021, 16:48Now its giving wrong price (wrong conversion)
Final price is OK - Regular price when there is a Sale price becoming akward.
Please advise.
Now its giving wrong price (wrong conversion)
Final price is OK - Regular price when there is a Sale price becoming akward.
Please advise.
Quote from Pablo Borysenco on January 7, 2021, 11:16Hello
Please drop me wp-admin + FTP access - https://c2n.me/43SC6rb.png ->https://c2n.me/42BAoj4.png
Hello
Please drop me wp-admin + FTP access - https://c2n.me/43SC6rb.png ->https://c2n.me/42BAoj4.png