I’m trying to change the Woocommerce’s product default currency based on the category.
Like if "Audio" is a category then set the EUR to be the currency.
I’ve tried the code below but it’s not working:
function change_woocommerce_currency( $currency ) {
if ( is_product_category( 'audio' ) ) {
$currency = 'EUR';
}
return $currency;
}
add_filter( 'woocommerce_currency', 'change_woocommerce_currency' );
The currency price needs to be changed on the product page as well that currency to be on the cart and checkout page, and the charge needs to happen in that category’s currency.
4
Answers
You have various ways to do that. First, you can use a plugin, such as "WooCommerce Currency per Product", this lets you add a specific currency to any item you want.
If you want to do it by code, this is how i would have done it :
Please try this
First, you can create a custom field with ACF to store EUR regular prices (For example: regular_price_eur)
Then, you can filter the price and change its currency symbol based on the category.