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.

Sun Mon Tue Wed Thu Fri Sat
- 12:00 – 14:00 12:00 – 14:00 12:00 – 14:00 12:00 – 14:00 12:00 – 14:00 -
- 17:00 – 21:00 17:00 – 21:00 17:00 – 21:00 17:00 – 21:00 17:00 – 21:00 -

Supporter timezone: Europe/Vienna (GMT+02:00)

This topic contains 15 replies, has 3 voices.

Last updated by Sumit 1 year, 8 months ago.

Assisted by: Bigul.

Author Posts
August 10, 2022 at 10:55 am #11839925

Sumit
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hi,

I am Sumit from 2nd tier support.

I just checked the code and found the solution. We have a global instance $woocommerce_wpml which holds everything you need.

As you said

Atm we just commented your badly coded add_filter (since the other way has severe performance penalties), but we don't want to maintain a fork and guide you towards WP and PHP best practices.

This is not true, we are following the best practice and standards. If you have any suggestions you are welcome to share them.
From the above SE link, we already use that approach using Make function hidden link

It seems, your developer did not look deeper to remove the action. Please see the code to remove this action

/**
 * @see wpmlsupp-9995
 */
add_action('init', function(){
	global $woocommerce_wpml;
	if (method_exists($woocommerce_wpml, 'get_multi_currency')) {
		$multi_currency = $woocommerce_wpml->get_multi_currency();
		remove_action('init', [$multi_currency->custom_prices, 'custom_prices_init']);
	}
}, 1);

NOTE:- The custom prices are not an optional feature and this is not part of our API. We are sharing this piece of code as an example.
As per our support policy, we can not provide further support if you see unexpected results after removing this action.
However, you are welcome to ask questions related to our code and API.

I hope you understand.
Thanks

The topic ‘[Closed] remove_filter for custom_prices_init’ is closed to new replies.