Skip to content

Instantly share code, notes, and snippets.

@jessepearson
Last active February 14, 2024 11:15
Show Gist options
  • Save jessepearson/0a4a2da18bdeef20b80b50ff0e727c61 to your computer and use it in GitHub Desktop.
Save jessepearson/0a4a2da18bdeef20b80b50ff0e727c61 to your computer and use it in GitHub Desktop.
This is a filter to disable Multi-Currency in WooCommerce Payments.
<?php // Do not copy this line.
// This is a filter to disable Multi-Currency in WooCommerce Payments.
add_filter(
'pre_option__wcpay_feature_customer_multi_currency',
function ( $pre_option, $option, $default ) {
return '0';
},
10,
3
);
@zipitfast
Copy link

Hi @jessepearson I badly need something like this right now but it looks like this doesn't work anymore and this is the only piece of code I've seen that can potentially disable the multi currency from working programmatically. If you have time do you know of any other way this can be disabled ? What I really need is to disable multi currency from from converting a specific product. Any help will be appreciated. Thanks

@jessepearson
Copy link
Author

@zipitfast IIRC I added this filter because initially Multi-Currency shipped without a way to disable it at all, now there is a toggle in WooPayments settings to turn it off.

As for disabling for one product, that might be able to be done with the use of this filter: https://github.com/Automattic/woocommerce-payments/blob/develop/includes/multi-currency/Compatibility.php#L154 . The filter would need to call a function that checks the $product passed, and if it matches the one you want to skip, then you return false.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment