PluginUs.Net - Business Tools for WooCommerce and WordPress

[realize your idea - make your dreams come true]
Botoscope is currently in early access

Support Forum

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

Only US$ currency automatically updated

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.
Support notice: Our support team will be on vacation from August 8 to September 3, so response times may be delayed and replies may be irregular.

From time to time I get an email like:

Base currency of the site is: EUR

  • USD: 1.140380859375

But in fact I have 8 other currencies configured that never seem to be updated automatically or the plugin doesn't report them to have been updated automatically.

Is this a bug or something I could configure? I want all currencies to be auto updated frequently.

Hello

I checked the code that builds that email. It lists every currency on the site except the base one, regardless of whether the rate was refreshed. With nine currencies you should always get eight lines, so a failed update cannot reduce it to one.

Which means at that moment the plugin was seeing two currencies, not nine. There is a path for that: if it cannot read your saved settings, it falls back to a built in default set, and with EUR as base that default is exactly EUR plus USD. That matches your email precisely. The usual cause is a persistent object cache briefly returning nothing, which would also explain why it happens only from time to time.

Please check and tell me:

  1. After one of these emails arrives, are all nine currencies still listed in the FOX settings
  2. Which rates provider is selected
  3. Does the site use Redis, Memcached or an object cache plugin
  4. Any lines in the PHP error log starting with [WOOCS] Failed to get rate for

Also, your actual purchase key is not on this ticket. Please add it in the private data section so I can confirm the license and continue.

https://share.pluginus.net/image/i20230222134241.png
https://share.pluginus.net/image/i20230222134615.png
https://share.pluginus.net/image/i20230222134511.png

Thanks for coming back to me. I added my license code.

1) yes, see: https://www.dropbox.com/scl/fi/psv8zuh3hvu68l93sxn8c/SCR-20260728-myzl.png?rlkey=7q7skrzq653b0d91sf8mwvtjc&dl=0

And they update fine, when I click on the button.

2) finance.yahoo, see my settings: https://www.dropbox.com/scl/fi/wqcpatfwoas5l62dbuxmn/SCR-20260728-mzwx.png?rlkey=3iu41k4xtsebjwhbubberr2o6&dl=0

3.) No

4.) Couldn't find such errors

Hello

Thank you for the screenshots, they help a lot.

First, let me correct my earlier answer. I suggested the plugin might be falling back to a default currency set. Your screenshots rule that out, all ten currencies are still in place, so that is not what is happening. I was wrong there.

Here is what I think is going on instead.

Rates are fetched one currency at a time, one request per currency. When a request comes back empty or with an error, the plugin keeps the previous rate rather than writing a zero, so nothing looks broken from the outside. Yahoo is known to limit rapid sequential requests coming from the same server, and that would mean only the first request in the run gets through while the rest are refused. In your list USD is the first currency after the base one. That matches your email exactly, and it also explains why it varies from time to time rather than failing consistently.

It also fits what you told me, that pressing"Update all rates" works. When you do it manually the requests are spread out differently, so they go through.

Two things to try, please.

First, please update to the latest version, 2.5.1. You are on 2.4.6 and there have been changes in this area since.

Second test. On the Currencies tab, use the Move handles to swap USD and GBP, so that GBP sits directly after EUR and USD moves down. Save, and wait for the next notification email. If the email then reports GBP instead of USD, we know for certain the problem is the position in the queue, not the currency itself and not the email.

Third test. Switch the aggregator to a different one in the Options tab. Right after switching, press"Update all rates" once and check that the new aggregator returns sensible values for all your currencies, some aggregators do not cover every currency. Then leave it running for a day and see what the next email contains.

Please tell me the result of both, and we will go from there.

 

Thanks for your concise answer.

I updated now to 2.5.1 (the reason I was still on the older version was the breaking bug in 2.5.0, which I reported earlier.) I've now tested 2.5.1 and it seems to be fixed indeed. Thanks for that.

2.) I've exchanged the US$ with British Pounds. Set the auto update to hourly, waited a couple of hours -> no email.

This is what I meant with"from time to time" in my original email. I get those emails infrequently, but when I get one, it's always only one currency listed.

Then I've tried changing the Currency provide, but to no avail.

  • Open Currency: Aggregator Error:Changing the API `base` currency is available for Developer, Enterprise and Unlimited plan clients. Please upgrade, or contact support@openexchangerates.org with any questions.
  • Fixer: Aggregator Error:rate_limit_reached
  • Currency Layer:"no data" for many currencies.

After creating those 3 accounts I gave up and went back to yahoo. This configuration should definitely be more straight forward.

With yahoo the manual update works and therefore I think, it should be possible for you to make the automatic update work the same way.

Another thing I noticed: clicking Update All Rates in the UI won't save. This is unintuitive. It means in the past I've often clicked on that button in order to update the rates, but they have never carried over. Sorry, but this is a bad UI design, because I guess 99% of all users won't scroll all the way down to save - especially since there is no warning about unsaved changes when leaving the page.

I'm still where I was before, but I hope my input helps!

Hello

Thank you for the detailed answers, they narrowed this down a lot.

First, what we did on our side. We set up the same feature on our own test server with a full set of currencies and let it run. It works correctly there: the notification email arrives on schedule and it lists every currency, not one. I am attaching a screenshot https://clip2net.com/s/4ocSlEu of one of those emails so you can see exactly what the normal result looks like. So the email builder itself is fine, and this is not a general defect in the plugin.

That points us at the difference between your server and ours, and there is a specific thing worth checking.

The plugin fetches rates one currency at a time, one outgoing HTTPS request per currency, with a 15 second timeout on each. With ten currencies configured, one full update run is nine outgoing requests in a row inside a single PHP process. On a server with fast outgoing connections that takes a couple of seconds and always completes. If outgoing connections are throttled, filtered or slow, each request can sit there until it times out, and the whole run can take over two minutes.

This matters because of where the run happens. When you press the update button in wp-admin, you are sitting there waiting for it and the request is allowed to finish. The automatic update is different: it runs in the background during an ordinary page load by a visitor to your shop. If that takes too long, the connection is closed by the web server or by the visitor's browser, and PHP stops the script. The email and the saving of the new rates are the very last steps of that run, so if it is cut off partway there is no email, no updated rates and nothing in any log. That matches what you described precisely, including the fact that the manual button always works.

To check whether this is what is happening, please add the script below temporarily, either to functions.php of your child theme or through a code snippets plugin. Then open any wp-admin page with ?woocs_diag=1 added to the URL, for example https://yoursite.com/wp-admin/index.php?woocs_diag=1

It changes nothing, it only measures. It performs the same outgoing request the plugin performs, once per currency, and reports how long each one took.

// FOX diagnostics: measure outgoing rate requests. Temporary, remove after use.
add_action( 'admin_init', function () {

	if ( ! isset( $_GET['woocs_diag'] ) || ! current_user_can( 'manage_woocommerce' ) ) {
		return;
	}

	$base       = get_option( 'woocommerce_currency' );
	$currencies = get_option( 'woocs', array() );
	$max_exec   = (int) ini_get( 'max_execution_time' );

	header( 'Content-Type: text/plain; charset=utf-8' );

	echo"FOX outgoing request diagnostics\n";
	echo"================================\n";
	echo 'Base currency            : ' . $base ."\n";
	echo 'Currencies configured    : ' . ( is_array( $currencies ) ? count( $currencies ) : 'OPTION NOT AN ARRAY' ) ."\n";
	echo 'max_execution_time       : ' . ( $max_exec ? $max_exec . 's' : 'unlimited' ) ."\n";
	echo 'default_socket_timeout   : ' . ini_get( 'default_socket_timeout' ) ."\n";
	echo 'WP_HTTP_BLOCK_EXTERNAL   : ' . ( defined( 'WP_HTTP_BLOCK_EXTERNAL' ) AND WP_HTTP_BLOCK_EXTERNAL ? 'ON (external requests blocked!)' : 'off' ) ."\n";
	echo 'WP_DEBUG_LOG             : ' . ( defined( 'WP_DEBUG_LOG' ) AND WP_DEBUG_LOG ? 'on' : 'OFF (error_log goes nowhere visible)' ) ."\n\n";

	if ( ! is_array( $currencies ) ) {
		echo"Cannot continue: the woocs option is not an array.\n";
		exit;
	}

	$total = 0;
	$now   = time();

	foreach ( $currencies as $code => $curr ) {

		if ( strtoupper( $code ) === strtoupper( $base ) ) {
			continue;
		}

		// Same URL shape the plugin uses for the Yahoo aggregator.
		$url = sprintf(
			'https://query1.finance.yahoo.com/v8/finance/chart/%1$s%2$s=X?symbol=%1$s%2$s&period1=%3$d&period2=%4$d&interval=1d&includePrePost=false&lang=en-US&region=US&corsDomain=finance.yahoo.com',
			$base,
			$code,
			$now - 60 * 86400,
			$now
		);

		$start    = microtime( true );
		$response = wp_remote_get( $url, array( 'timeout' => 15 ) );
		$secs     = round( microtime( true ) - $start, 2 );
		$total   += $secs;

		if ( is_wp_error( $response ) ) {
			$status = 'ERROR: ' . $response->get_error_message();
		} else {
			$body   = wp_remote_retrieve_body( $response );
			$data   = json_decode( $body, true );
			$ok     = isset( $data['chart']['result'][0] );
			$status = 'HTTP ' . wp_remote_retrieve_response_code( $response ) . ( $ok ? ' | rate data OK' : ' | NO RATE DATA' );
		}

		printf("%-6s %8ss   %s\n", $code, $secs, $status );
	}

	echo"\n";
	echo 'TOTAL for one full update run: ' . round( $total, 2 ) ."s\n";

	if ( $max_exec AND $total > $max_exec * 0.8 ) {
		echo"VERDICT: a full automatic run does NOT fit into max_execution_time on this server.\n";
	} else {
		echo"VERDICT: timing is not the limiting factor here.\n";
	}

	exit;
}, 999 );

 

Please copy the whole output back here. What we are looking for is the per currency timing and the total at the bottom. If each request takes ten to fifteen seconds, or you see connection errors, then a full automatic run cannot finish on your server and that is the answer. If everything comes back in well under a second, my suspicion is wrong and we will look elsewhere.

One more thing about the error log. You mentioned you could not find any lines starting with [WOOCS] Failed to get rate for. The script also reports whether WP_DEBUG_LOG is enabled on your site. If it is off, those messages have nowhere to be written, so their absence does not tell us anything either way.

If the timings do confirm it, then this is something to solve at the hosting level rather than in the plugin, and I will tell you exactly what to ask your hosting provider.

To make that conclusion solid rather than a suspicion, it would help a lot to see the same site behave differently on different hardware. Two ways to do that, whichever is easier for you.

The first is to create a snapshot of your site with Duplicator and send it to us. We would deploy it on our own server, run the automatic update there and see whether it completes. You would get login details for that copy so you can check the result yourself rather than take our word for it. Nothing on your live site would be touched.

The second, if you prefer not to hand over a copy, is to install it yourself on any other server, ideally with a different hosting company, and let the automatic update run there for a day. If the emails arrive complete there and not on your current host, that settles it.

Please start with the script, since it takes two minutes and may well answer the question on its own.

Thanks for your effort. Fortunately, sometime last night, the hourly updates started to come in. First time I got:

Base currency of the site is: EUR

  • GBP: 0.85591000318527
  • USD: 1.1530035734177
  • CHF: 0.9277999997139
  • AUD: 1.6396800279617
  • CAD: 1.6144200563431
  • JPY: 183.92500305176
  • CNY: 7.7617998123169
  • NOK: 10.999600410461
  • DKK: 7.4753198623657

Got a couple of emails during the night, but then they stopped coming again - it's not really hourly,. In those emails the values have always been exactly the same.
This is with yahoo.finance.

Update: today during the day, again, several emails came in, all with the exact same numbers.

I will continue monitoring this.

Hello

Thank you for you cooperation!