Skip Navigation

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

Tagged: 

This topic contains 28 replies, has 2 voices.

Last updated by Dražen Duvnjak 1 year, 1 month ago.

Assisted by: Dražen Duvnjak.

Author Posts
October 9, 2023 at 6:47 am #14536069

Jerzy Afanasjew

1) The issue is present on my site when using the script. You can refresh page every 20 seconds and see prices changing incorrectly same as with manual scheduling.

2) I tried but for some reason the script doesnt seem to work on your staging site, I mean even:

// Define the log file
$log_file = WP_CONTENT_DIR . '/promo.log';

I dont understand why.(note: wpml forum changes the above url from local to wpml.org

3) I put the script in child theme functions.php. It's fairly simple. It uses scheduling to every 20 seconds retrieve 66% of items from specified category and set sale price at 0.9 of the normal price. Code has thorough comments and you can see it work on my staging site. It should save /promo.log debugging output in wp-content directory. I hope you will understand why it doesnt work on your staging site, it works on all staging sites I set up myself.

October 9, 2023 at 7:18 am #14536371

Dražen Duvnjak
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+01:00)

Hello,

thanks.

I am trying to upload a plugin so I can create a copy and check further and escalate, but I keep being blocked by Wordfence even if it is disabled.

Please check further and make sure the plugins are disabled.

Thanks,
Drazen

October 9, 2023 at 5:56 pm #14542063

Jerzy Afanasjew

I'm sorry but I cant replicate this issue, I logged in via the login link provided to you earlier and uploaded a plugin without any problem. Perhaps you are seing not Wordfence block but a server side WAF error, is the error screen white with red logo? If so, unblock your IP on this page on our hosting site: hidden link (choose s29.mydevil.net)

October 10, 2023 at 5:43 am #14544147

Dražen Duvnjak
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+01:00)

Hello,

I am afraid still the same, and it is a Wordfence message, image attached.

Can you please install the Duplicator plugin, exclude large files like wp-uploads, and create a package so we can test this further.

- https://wpml.org/faq/provide-supporters-copy-site/

Thanks,
Drazen

Screenshot_1.jpg
October 10, 2023 at 6:22 am #14544613

Jerzy Afanasjew

I have temporarily deactivated Wordfence on my server, Duplicator didnt work due to openbasedir forced by my hosting.

October 10, 2023 at 8:39 am #14547467

Dražen Duvnjak
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+01:00)

Hello,

thanks.

I am trying to build a Duplicator package but it is taking already a few hours. I will check again later today or tomorrow to see if it was sucesfually created and check further.

Thanks,
Drazen

October 10, 2023 at 12:52 pm #14550075

Dražen Duvnjak
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+01:00)

Hello,

1) Can you please try to run and create a Duplicator package excluding large files like the wp-upload folder? As for me, it is taking too long and eventually gets canceled by the server, so I can not create it-

2) I have also updated the WPML plugins and set the scheduled sale price to see if the issue still happens tomorrow morning.

Thanks,
Drazen

October 10, 2023 at 5:33 pm #14553015

Jerzy Afanasjew

Hi,

I found out the staging site you set up had cron disabled by default, I enabled it and now my script works there. You can troubleshoot the issue and see changes in real time (well, every 20 seconds). We can skip the Duplicator.

October 11, 2023 at 6:04 am #14555161

Dražen Duvnjak
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+01:00)

Hello,

thanks, but we still need the Duplicator package, so this issue can be escalated and checked further.

Please try, increase server timeout and let me know when it is done. Just make sure to exclude large files, since it would be difficult to deploy a 6GB package.

Regards,
Drazen

October 11, 2023 at 6:49 am #14555383

Jerzy Afanasjew

Maybe run Duplicator on your staging site, since it also shows the same issue?

Duplicator doesnt work on my server. I don't think the problem is server timeout because progress gets stuck fairly early. You can use other similar plugins if you insist, I recommend WPVivivd Backup which works on my servver. I don't know why exactly Duplicator gets stuck as I haven't found any relevant logs.

October 11, 2023 at 7:31 am #14555831

Dražen Duvnjak
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+01:00)

Hello,

you are right, I missed the point that now the issue happens on a sandbox, thanks.

I have taken a DB dump of your website and the full package from the sandbox site.

I have also escalated this issue to our 2nd tier to check and advise further.

I will update you as soon as I have some news.

Regards,
Drazen

October 12, 2023 at 5:46 am #14562603

Dražen Duvnjak
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+01:00)

Hello,

thanks for your patience.

Our 2nd tier confirmed the bug and it is escalated to our devs for a fix in future versions.

Please note we have checked with the regular WC sale price scheduled, not your code, as this would require further adaptation.

The issue happens because prices are converted to 2nd currency before being set as the sale price. Due to this in primary currency, you see the converted price and in 2nd currency, it is converted again, both in the wrong language.

In the meantime you can use the next workaround code which fixes the issue for scheduled prices:

/**
 * @link wpmlsupp-11119
 */
function wpmlsupp_11119_remove_price_filter() {
	global $woocommerce_wpml;
	$actions_to_remove_back = [
		'wc_before_products_starting_sales' => 'wc_after_products_starting_sales',
		'wc_before_products_ending_sales' => 'wc_after_products_ending_sales',
	];

	if ($woocommerce_wpml instanceof woocommerce_wpml && isset($actions_to_remove_back[current_action()])) {
		remove_filter('get_post_metadata', [$woocommerce_wpml->multi_currency->prices, 'product_price_filter'], 10);
		add_action($actions_to_remove_back[current_action()], function () use ($woocommerce_wpml) {
			add_filter('get_post_metadata', [$woocommerce_wpml->multi_currency->prices, 'product_price_filter'], 10, 4);
		});
	}
}
add_action('wc_before_products_starting_sales', 'wpmlsupp_11119_remove_price_filter');
add_action('wc_before_products_ending_sales', 'wpmlsupp_11119_remove_price_filter');

Regards,
Drazen

October 14, 2023 at 4:58 pm #14577581

Jerzy Afanasjew

Thank you. Is there any ETA for the official fix? The workaround doesn't work with my custom code but I presume it should work with the oficial fix.

One thing still puzzles me though. We were able to confirm the issue on a fresh staging site. My main site experiences the issue too. But a staging site duplicate of my main site which I set up about a month ago suddenly does not experience the issue. How can that be, if all settings and configuration appear the same? Are you interested in checking out that staging site?

October 16, 2023 at 6:20 am #14581417

Dražen Duvnjak
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+01:00)

Hello,

I am afraid I can not share any ETA,m but for now, it is scheduled for WCML 5.5.0., that is the best I can say.

As for the staging site, I do not see how that would help us since the issue is already confirmed and escalated for a fix, and was reproduced on a fresh staging site from our side. The best that I can think of is, that the currency/language has been set differently so it doesn't happen there.

Regards,
Drazen