Approximate price is not consistent
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 Pablo Borysenco on May 20, 2022, 16:06Hello
Please do a test
In file - \wp-content\plugins\woocommerce-currency-switcher\classes\woocs.php - these functions - https://share.pluginus.net/image/i20220520133633.png
All the magic happens here - https://share.pluginus.net/image/i20220520140024.png
Hello
Please do a test
In file - \wp-content\plugins\woocommerce-currency-switcher\classes\woocs.php - these functions - https://share.pluginus.net/image/i20220520133633.png
All the magic happens here - https://share.pluginus.net/image/i20220520140024.png
Quote from abd_sa on May 21, 2022, 01:04Hello
So far everything seems to be good finally :D Thanks a lot
ohh I see where I can modify now, so basically I just need to add another filter inside the
ifof show approx info, but how do you find the name of the filters ?And why the approx word in the cart widget is upper case ?
Another question (which is not technical), I just need to know your opinion, do you think using
Approxis good from a customer perspective ? do you know any example of an e-commerce website using it ?
Hello
So far everything seems to be good finally :D Thanks a lot
ohh I see where I can modify now, so basically I just need to add another filter inside the if of show approx info, but how do you find the name of the filters ?
And why the approx word in the cart widget is upper case ?
Another question (which is not technical), I just need to know your opinion, do you think using Approx is good from a customer perspective ? do you know any example of an e-commerce website using it ?
Quote from abd_sa on May 21, 2022, 03:31Another question please, have you changed other files other than the plugin's files ?
I tried to copy the plugin's files from staging to the main website, the apporx prices are shown everywhere which is good, however this inconsistency still in some places, but afterwards it works except in the wallet transactions! just like magic! I don't know why!
I tried to copy the files to the staging again to replicate the issue, but the inconsistency appears again!!
I was trying to know from where this comes from but in vain!
Could you please tell me how do you solve this inconsistency of prices!
Another question please, have you changed other files other than the plugin's files ?
I tried to copy the plugin's files from staging to the main website, the apporx prices are shown everywhere which is good, however this inconsistency still in some places, but afterwards it works except in the wallet transactions! just like magic! I don't know why!
I tried to copy the files to the staging again to replicate the issue, but the inconsistency appears again!!
I was trying to know from where this comes from but in vain!
Could you please tell me how do you solve this inconsistency of prices!
Quote from Pablo Borysenco on May 23, 2022, 10:53Hello
but how do you find the name of the filters ? - Unfortunately, I didn't understand your question.
And why the approx word in the cart widget is upper case ? - Because the following string is added in the code - https://share.pluginus.net/image/i20220523084736.png
I just need to know your opinion, do you think using
Approxis good from a customer perspective ? - Unfortunately we didn't do any research. This functionality is a request from our usershave you changed other files other than the plugin's files ? - All changes are only in this file - \wp-content\plugins\woocommerce-currency-switcher\classes\woocs.php
Could you please tell me how do you solve this inconsistency of prices! - Unfortunately, there is no universal way, for each case an investigation is needed.
Hello
but how do you find the name of the filters ? - Unfortunately, I didn't understand your question.
And why the approx word in the cart widget is upper case ? - Because the following string is added in the code - https://share.pluginus.net/image/i20220523084736.png
I just need to know your opinion, do you think using Approx is good from a customer perspective ? - Unfortunately we didn't do any research. This functionality is a request from our users
have you changed other files other than the plugin's files ? - All changes are only in this file - \wp-content\plugins\woocommerce-currency-switcher\classes\woocs.php
Could you please tell me how do you solve this inconsistency of prices! - Unfortunately, there is no universal way, for each case an investigation is needed.
Quote from abd_sa on May 24, 2022, 01:04Hello,
1- For example
add_filter('woocommerce_cart_total, array($this, 'woocommerce_cart_total'), 9999, 1);how to know the name of the filter (or is it called hooks in wp I suppose ? ) herewoocmmerce_cart_total?2- 3- OK thanks.
4- yeah, but where it comes from!! basically the plugin should take the price, multiply by the rate and
echoit! Could you please tell me how you are debugging it ? do you use any plugins for that ? Thanks in advance
Hello,
1- For example add_filter('woocommerce_cart_total, array($this, 'woocommerce_cart_total'), 9999, 1); how to know the name of the filter (or is it called hooks in wp I suppose ? ) here woocmmerce_cart_total ?
2- 3- OK thanks.
4- yeah, but where it comes from!! basically the plugin should take the price, multiply by the rate and echo it! Could you please tell me how you are debugging it ? do you use any plugins for that ? Thanks in advance
Quote from Pablo Borysenco on May 24, 2022, 10:03Hello
Unfortunately I'm not a programming teacher
1 Please read this - https://developer.wordpress.org/plugins/hooks/
4 For debugging I use FTP client. find the desired function using Ctrl+F. To display the desired information (for example, the price) I use the function var_dump()
Hello
Unfortunately I'm not a programming teacher
1 Please read this - https://developer.wordpress.org/plugins/hooks/
4 For debugging I use FTP client. find the desired function using Ctrl+F. To display the desired information (for example, the price) I use the function var_dump()
Quote from abd_sa on May 25, 2022, 07:26Hello,
Yeah I am just a beginner who wants to learn more, I am really sorry for my endless questions.
I will try to debug and see if I can know what is happening! Thanks for the information.
Do you know if there is a way to test this functionality with different countries ? I tried a proxy to change the country but it does not work!
Hello,
Yeah I am just a beginner who wants to learn more, I am really sorry for my endless questions.
I will try to debug and see if I can know what is happening! Thanks for the information.
Do you know if there is a way to test this functionality with different countries ? I tried a proxy to change the country but it does not work!
Quote from Pablo Borysenco on May 25, 2022, 10:00Hello
Read this please - https://currency-switcher.com/using-geolocation-causes-problems-doesnt-seem-to-work-for-me
Hello
Read this please - https://currency-switcher.com/using-geolocation-causes-problems-doesnt-seem-to-work-for-me
Quote from abd_sa on May 26, 2022, 02:54Hello,
Thank you very much for the instructions.
The GeoIP seems to be working, Is there a way to set the store currency to USD and show the approx price always, unless the user change it manually on the woocs widget ?
Now the behavior is when a user -let's say from France- landed on the website, the currency will change to Euro and thereby the approx prices will not show! I want to show the prices in USD for all countries and show the approx prices based on the GeoIP of the user ?
Hello,
Thank you very much for the instructions.
The GeoIP seems to be working, Is there a way to set the store currency to USD and show the approx price always, unless the user change it manually on the woocs widget ?
Now the behavior is when a user -let's say from France- landed on the website, the currency will change to Euro and thereby the approx prices will not show! I want to show the prices in USD for all countries and show the approx prices based on the GeoIP of the user ?
Quote from Pablo Borysenco on May 26, 2022, 11:51Hello
unfortunately the plugin does not have this feature.
You need code customization.
In file - wp-content\plugins\woocommerce-currency-switcher\classes\woocs.php - find all functions that add "Approx" and change this code - https://share.pluginus.net/image/i20220526094956.png
Hello
unfortunately the plugin does not have this feature.
You need code customization.
In file - wp-content\plugins\woocommerce-currency-switcher\classes\woocs.php - find all functions that add"Approx" and change this code - https://share.pluginus.net/image/i20220526094956.png
Quote from abd_sa on May 27, 2022, 08:31Hello,
In that case the
$user_currencywill always beUSD, even if the user tries to change it manually, the function will get executed again (because the approx price is activated) and it will override the value chosen by the user from the widget.I will try to investigate it more, or if yo have any other hints please let me know.
Thanks.
Hello,
In that case the $user_currency will always be USD , even if the user tries to change it manually, the function will get executed again (because the approx price is activated) and it will override the value chosen by the user from the widget.
I will try to investigate it more, or if yo have any other hints please let me know.
Thanks.
Quote from Pablo Borysenco on May 27, 2022, 11:54Hello
In that case the
$user_currencywill always beUSD, even if the user tries to change it manually, the function will get executed again (because the approx price is activated) and it will override the value chosen by the user from the widget. - Absolutely no! It does not affect the current currency
Hello
In that case the $user_currency will always be USD , even if the user tries to change it manually, the function will get executed again (because the approx price is activated) and it will override the value chosen by the user from the widget. - Absolutely no! It does not affect the current currency
Quote from abd_sa on May 28, 2022, 06:10Hello,
But when I tried yesterday I ran into this issue. It worked, however when I wanted to change the currency manually from the widget, it keeps returning back to USD.
Anyways, I managed to get it to work, basically the logic was there, but maybe it is a bug or something.
So here is what I did, maybe it will help someone who wants to achieve the same workflow.
I found that there is a logic for
Welcome user currency activation(here https://prnt.sc/3EQUSJ8n4M0O ) which is set to USD on the plugin settings, so basically on the first visit of the user the currency should be USD. But that's not the case, if the user is from a country which is defined on the GeoIP rules, the currency will be changed accordingly.So after some investigation I noticed that the value you are getting inside the if condition
woocs_first_unique_visitis never set up on the entire script, that's why this bloc of code will never run.I found that you are setting a similar value inside
function init_geo_currency()which iswoocs_first_unique_geoipso I replaced the previous string with this one, and it worked.
However, the previous logic was also good, Maybe in the future, I will need the plugin to change the currency automatically based on the GeoIP rules.
So to not to loose both options, what I did is I added another option to the settings https://prnt.sc/2MHSmXuaTiSy and I added this condition inside the
ifstatementHere is the final code:
1- file ./views/plugin_options_2.php: https://prnt.sc/R75yQlDRCWXu
<!-- another option to whether activate or not the welcome currency -->
<tr>
<td data-title="<?php echo esc_html__('Option', 'woocommerce-currency-switcher') ?>">
<?php echo esc_html__('Activate welcome currency on first visit', 'woocommerce-currency-switcher') ?>
</td>
<td data-title="<?php echo esc_html__('Status', 'woocommerce-currency-switcher') ?>">
<div class="woocs__table-card">
<?php echo draw_switcher23('woocs_activate_welcome_currency', get_option('woocs_activate_welcome_currency', 0)); ?>
</div>
</td>
<td data-title="<?php echo esc_html__('Description', 'woocommerce-currency-switcher') ?>">
<div class="woocs__table-desc">
<div class="woocs__table-desc-body">
<?php echo esc_html__("If True, on the first visit of the user, the currency will be set to the welcome currency selected above until he change it manually. Leave it False if you want the plugin to change it automatically to the adequate currency based on the GeoIP rules.", 'woocommerce-currency-switcher') ?>
</div>
</div>
</td>
</tr>
2- file ./classes/woocs.php https://prnt.sc/u_rvOIrOXuj2
( note: there are two places with the same logic, I changed them both)
//WELCOME USER CURRENCY ACTIVATION
if (intval($this->storage->get_val('woocs_first_unique_geoip')) === 0 AND get_option('woocs_activate_welcome_currency', 0)) {
$this->is_first_unique_visit = true;
$this->set_currency($this->get_welcome_currency());
$this->storage->set_val('woocs_first_unique_geoip', 1);
}3- file ./classes/woocs.php https://prnt.sc/EWs0Xg7cMXvp
// activate welcome currency
update_option('woocs_activate_welcome_currency', 0);4- file ./classes/woocs.php https://prnt.sc/WsxkSBI38UFu
// activate welcome currency
update_option('woocs_activate_welcome_currency', (int) $_POST['woocs_activate_welcome_currency']);I don't know yet if there are any side effects to what I did, but it worked perfectly so far.
Please give me your feedback or correct me if I made a mistake.
Thanks!
Hello,
But when I tried yesterday I ran into this issue. It worked, however when I wanted to change the currency manually from the widget, it keeps returning back to USD.
Anyways, I managed to get it to work, basically the logic was there, but maybe it is a bug or something.
So here is what I did, maybe it will help someone who wants to achieve the same workflow.
I found that there is a logic for Welcome user currency activation(here https://prnt.sc/3EQUSJ8n4M0O ) which is set to USD on the plugin settings, so basically on the first visit of the user the currency should be USD. But that's not the case, if the user is from a country which is defined on the GeoIP rules, the currency will be changed accordingly.
So after some investigation I noticed that the value you are getting inside the if condition woocs_first_unique_visit is never set up on the entire script, that's why this bloc of code will never run.
I found that you are setting a similar value inside function init_geo_currency() which is woocs_first_unique_geoip so I replaced the previous string with this one, and it worked.
However, the previous logic was also good, Maybe in the future, I will need the plugin to change the currency automatically based on the GeoIP rules.
So to not to loose both options, what I did is I added another option to the settings https://prnt.sc/2MHSmXuaTiSy and I added this condition inside the if statement
Here is the final code:
1- file ./views/plugin_options_2.php: https://prnt.sc/R75yQlDRCWXu
<!-- another option to whether activate or not the welcome currency -->
<tr>
<td data-title="<?php echo esc_html__('Option', 'woocommerce-currency-switcher') ?>">
<?php echo esc_html__('Activate welcome currency on first visit', 'woocommerce-currency-switcher') ?>
</td>
<td data-title="<?php echo esc_html__('Status', 'woocommerce-currency-switcher') ?>">
<div class="woocs__table-card">
<?php echo draw_switcher23('woocs_activate_welcome_currency', get_option('woocs_activate_welcome_currency', 0)); ?>
</div>
</td>
<td data-title="<?php echo esc_html__('Description', 'woocommerce-currency-switcher') ?>">
<div class="woocs__table-desc">
<div class="woocs__table-desc-body">
<?php echo esc_html__("If True, on the first visit of the user, the currency will be set to the welcome currency selected above until he change it manually. Leave it False if you want the plugin to change it automatically to the adequate currency based on the GeoIP rules.", 'woocommerce-currency-switcher') ?>
</div>
</div>
</td>
</tr>
2- file ./classes/woocs.php https://prnt.sc/u_rvOIrOXuj2
( note: there are two places with the same logic, I changed them both)
//WELCOME USER CURRENCY ACTIVATION
if (intval($this->storage->get_val('woocs_first_unique_geoip')) === 0 AND get_option('woocs_activate_welcome_currency', 0)) {
$this->is_first_unique_visit = true;
$this->set_currency($this->get_welcome_currency());
$this->storage->set_val('woocs_first_unique_geoip', 1);
}
3- file ./classes/woocs.php https://prnt.sc/EWs0Xg7cMXvp
// activate welcome currency
update_option('woocs_activate_welcome_currency', 0);
4- file ./classes/woocs.php https://prnt.sc/WsxkSBI38UFu
// activate welcome currency
update_option('woocs_activate_welcome_currency', (int) $_POST['woocs_activate_welcome_currency']);
I don't know yet if there are any side effects to what I did, but it worked perfectly so far.
Please give me your feedback or correct me if I made a mistake.
Thanks!
Quote from Pablo Borysenco on May 30, 2022, 10:08Hello
Thank you for your cooperation!
Hello
Thank you for your cooperation!
Quote from abd_sa on May 31, 2022, 05:29Hello,
You are welcome :)
Hello,
You are welcome :)