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

Get "regular price" of fixed price product when on sale

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.

Hello,

We've been using the plugin for a while and ran across the following issue:

When trying to"$product->get_regular_price()" of a"fixed price" product while it's on sale, the regular price returns as the sale price.

Our Woo store is CAD based and we have USD as fixed price for each product.

The issue occurs when trying to get the regular price in USD when it's on sale.

Thank you for your help!

Hello

Unfortunately, this is how it works.  The product has a standard sale price?

Hello!

Please find the attached screenshot, it explains the situation better.

Let me know if you have any questions :)

Thank you,

Hello

Try  in file - wp-content\plugins\woocommerce-currency-switcher\classes\fixed\fixed_price.php

add  this  code  - https://c2n.me/4bPUObA.png

if($regular_price == $price){
return 'regular';
}elseif ($sale_price == $price){
return 'sale';
}

clear  all cache and  do  a test

Hello,

That worked! But we are getting the following errors:

Notice: Undefined variable: regular_price in /....../wp-content/plugins/woocommerce-currency-switcher/classes/fixed/fixed_price.php on line 234

Notice: Undefined variable: sale_price in /......../wp-content/plugins/woocommerce-currency-switcher/classes/fixed/fixed_price.php on line 236

Any ideas?

Thank you!

Hello

Ok!  Try  it please:

if( isset($regular_price) && $regular_price == $price){
return 'regular';
}elseif (isset($sale_price) && $sale_price == $price){
return 'sale';
}

Awesome! It worked.

Thank you :)

Hello

Welcome;)