Problem with displaying fixed price
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 pleaseIf 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.
Quote from Сергей on February 29, 2024, 12:17Hello, I want to use fixed prices for some products in another currency, dollar, to display them in hryvnia after automatic conversion, is this possible?
I indicate prices throughout the site in hryvnias, but I need to indicate some products in dollars and display them on the site after conversion into hryvnias.
I tried to configure this myself, but it doesn’t work for me as I need and it turns out that the site displays the price that is taken in hryvnias, and the price that I indicated in dollars in the fixed price rules for this particular product is ignored by the plugin and does not convert it and does not display it .
When I do the opposite, it works, a working example: the default currency is dollar, display for all guests and visitors in hryvnias, the price of the product is indicated in dollars and in the fixed price rules in hryvnias, then the plugin displays the price that I specified in the fixed price rules ( this is what needs to be displayed) when I remove the fixed price rules, it takes the price in dollars and converts them into hryvnias and displays it correctly on the site too.
Hello, I want to use fixed prices for some products in another currency, dollar, to display them in hryvnia after automatic conversion, is this possible?
I indicate prices throughout the site in hryvnias, but I need to indicate some products in dollars and display them on the site after conversion into hryvnias.
I tried to configure this myself, but it doesn’t work for me as I need and it turns out that the site displays the price that is taken in hryvnias, and the price that I indicated in dollars in the fixed price rules for this particular product is ignored by the plugin and does not convert it and does not display it .
When I do the opposite, it works, a working example: the default currency is dollar, display for all guests and visitors in hryvnias, the price of the product is indicated in dollars and in the fixed price rules in hryvnias, then the plugin displays the price that I specified in the fixed price rules ( this is what needs to be displayed) when I remove the fixed price rules, it takes the price in dollars and converts them into hryvnias and displays it correctly on the site too.
Quote from Pablo Borysenco on February 29, 2024, 13:09Hello
Unfortunately the plugin does not have such a feature
Hello
Unfortunately the plugin does not have such a feature
Quote from Сергей on February 29, 2024, 13:28Can I Use Hooks and Filters: If the plugin provides hooks or filters, I can use them to change the price display logic. For example, I can write a function that will check whether a product has a fixed price in dollars, and if so, convert this price into hryvnia at the current rate and display it.
Can I Use Hooks and Filters: If the plugin provides hooks or filters, I can use them to change the price display logic. For example, I can write a function that will check whether a product has a fixed price in dollars, and if so, convert this price into hryvnia at the current rate and display it.
Quote from Сергей on February 29, 2024, 13:35//Function for converting prices from dollars to hryvnia
function convert_price_from_usd_to_uah($price_in_usd) {
$exchange_rate = 27.25; //Approximate exchange rate, here I would like to receive a dynamically current exchange rate from your plugin
return $price_in_usd * $exchange_rate;
}//Filter for changing product price and variation price
add_filter('woocommerce_product_variation_get_price', 'convert_fixed_price_in_usd_to_uah', 10, 2);
add_filter('woocommerce_product_variation_get_regular_price', 'convert_fixed_price_in_usd_to_uah', 10, 2);
add_filter('woocommerce_product_get_price', 'convert_fixed_price_in_usd_to_uah', 10, 2);
add_filter('woocommerce_product_get_regular_price', 'convert_fixed_price_in_usd_to_uah', 10, 2);//A function that changes the price of a variation if the price is set to a fixed dollar price
function convert_fixed_price_in_usd_to_uah($price, $product) {
//Getting the product or variation ID
$product_id = $product->get_id();//Building a metafield key for a fixed price in dollars
$meta_key = '_woocs_regular_price_USD';//Trying to get a fixed price in dollars
$fixed_price_in_usd = get_post_meta($product_id, $meta_key, true);if (!empty($fixed_price_in_usd)) {
//We convert the price into hryvnia and return it
return convert_price_from_usd_to_uah($fixed_price_in_usd);
}//We return the original price if a fixed price in dollars is not set
return $price;
}
//Function for converting prices from dollars to hryvnia
function convert_price_from_usd_to_uah($price_in_usd) {
$exchange_rate = 27.25; //Approximate exchange rate, here I would like to receive a dynamically current exchange rate from your plugin
return $price_in_usd * $exchange_rate;
}//Filter for changing product price and variation price
add_filter('woocommerce_product_variation_get_price', 'convert_fixed_price_in_usd_to_uah', 10, 2);
add_filter('woocommerce_product_variation_get_regular_price', 'convert_fixed_price_in_usd_to_uah', 10, 2);
add_filter('woocommerce_product_get_price', 'convert_fixed_price_in_usd_to_uah', 10, 2);
add_filter('woocommerce_product_get_regular_price', 'convert_fixed_price_in_usd_to_uah', 10, 2);//A function that changes the price of a variation if the price is set to a fixed dollar price
function convert_fixed_price_in_usd_to_uah($price, $product) {
//Getting the product or variation ID
$product_id = $product->get_id();//Building a metafield key for a fixed price in dollars
$meta_key = '_woocs_regular_price_USD';//Trying to get a fixed price in dollars
$fixed_price_in_usd = get_post_meta($product_id, $meta_key, true);if (!empty($fixed_price_in_usd)) {
//We convert the price into hryvnia and return it
return convert_price_from_usd_to_uah($fixed_price_in_usd);
}//We return the original price if a fixed price in dollars is not set
return $price;
}
Quote from Pablo Borysenco on March 1, 2024, 11:02Hello
You can check it here - https://currency-switcher.com/codex#functions and https://currency-switcher.com/codex#filters
for example for currency conversion: https://currency-switcher.com/function/woocs-woocs_exchange_value
To get fixed price:
global $WOOCS;
$WOOCS->_get_product_fixed_price($product,$product_type, $price, $precision);
Hello
You can check it here - https://currency-switcher.com/codex#functions and https://currency-switcher.com/codex#filters
for example for currency conversion: https://currency-switcher.com/function/woocs-woocs_exchange_value
To get fixed price:
global $WOOCS;
$WOOCS->_get_product_fixed_price($product,$product_type, $price, $precision);