Add fixed price rule to a non-standard product type?
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 Jamie on July 28, 2022, 07:35I understand how to add a fixed price rule per product when adding a simple product in woocommerce. However, I'm using a plugin that adds a product type called "Lottery" and the option to set a fixed price on those products completely disappears when I switch over to that product type.
Is there any way to add a fixed price on a particular product in a currency using that product's post ID or name by using a function or shortcode? I know this is a short-term workaround, but I could really use some help.
For example, if my shop's main currency is British pounds (GBP) and I have a lottery type of product and I want to send a fixed price for my visitors from Thailand in Thai baht (THB) at 100 baht per lottery ticket, is there a function or shortcode I can use to do this?
Currently, I can set the price to an amount in GBP that's around 100 Thai baht and then let the sitewide Geo IP rules handle the conversion. For example, I can set a price to 2.25 GBP which fluctuates between 99 to 101 Thai baht when my customers from Thailand visit the product page, but I'd like to set a fixed price at exactly 100 THB.
Since the fixed price rules aren't available for this lottery product type, is there a function or shortcode that could handle this when combined with the product id?
Hope I'm explaining this clearly, thanks for any help you can offer.
I understand how to add a fixed price rule per product when adding a simple product in woocommerce. However, I'm using a plugin that adds a product type called"Lottery" and the option to set a fixed price on those products completely disappears when I switch over to that product type.


Is there any way to add a fixed price on a particular product in a currency using that product's post ID or name by using a function or shortcode? I know this is a short-term workaround, but I could really use some help.
For example, if my shop's main currency is British pounds (GBP) and I have a lottery type of product and I want to send a fixed price for my visitors from Thailand in Thai baht (THB) at 100 baht per lottery ticket, is there a function or shortcode I can use to do this?
Currently, I can set the price to an amount in GBP that's around 100 Thai baht and then let the sitewide Geo IP rules handle the conversion. For example, I can set a price to 2.25 GBP which fluctuates between 99 to 101 Thai baht when my customers from Thailand visit the product page, but I'd like to set a fixed price at exactly 100 THB.
Since the fixed price rules aren't available for this lottery product type, is there a function or shortcode that could handle this when combined with the product id?
Hope I'm explaining this clearly, thanks for any help you can offer.
Quote from Pablo Borysenco on July 28, 2022, 11:13hello
Fixed prices only work for standard product types. Unfortunately there is no other way to do this.
we are preparing a new version of the plugin where there will be a hook for adding fixed prices for custom product types. But we cannot guarantee that third party product types will work correctly with fixed prices.
hello
Fixed prices only work for standard product types. Unfortunately there is no other way to do this.
we are preparing a new version of the plugin where there will be a hook for adding fixed prices for custom product types. But we cannot guarantee that third party product types will work correctly with fixed prices.
Quote from Jamie on July 28, 2022, 14:06Thank you @pavlo_borysenco for your reply and explanation.
I checked the codex and realized that a rounding function is probably good enough to keep my prices converted for THB looking ok.
I'm trying to use the hook you mention here: https://currency-switcher.com/hook/woocs_raw_woocommerce_price/
I added it to round my price in THB to the nearest 50 baht:
add_filter('woocs_raw_woocommerce_price', function($price) {
if (($price <= 100))
{
$price = round($price / 100, 0) * 100;
return $price;
} else
{
$price = ceil($price / 50) * 50;
return $price;
}
});It's working great on the front end for my prices in THB, but it's also applying these rules to my main currency in GBP.
Any idea how to get this hook to only work for THB and my customers detected by Geoip in Thailand, and not have it applied to my main currency of GBP for the rest of the world?Thanks for all your help. Your plugin and support are both great!
Thank you @pavlo_borysenco for your reply and explanation.
I checked the codex and realized that a rounding function is probably good enough to keep my prices converted for THB looking ok.
I'm trying to use the hook you mention here: https://currency-switcher.com/hook/woocs_raw_woocommerce_price/
I added it to round my price in THB to the nearest 50 baht:
add_filter('woocs_raw_woocommerce_price', function($price) {
if (($price <= 100))
{
$price = round($price / 100, 0) * 100;
return $price;
} else
{
$price = ceil($price / 50) * 50;
return $price;
}
});
It's working great on the front end for my prices in THB, but it's also applying these rules to my main currency in GBP.
Any idea how to get this hook to only work for THB and my customers detected by Geoip in Thailand, and not have it applied to my main currency of GBP for the rest of the world?
Thanks for all your help. Your plugin and support are both great!
Quote from Pablo Borysenco on July 29, 2022, 09:08Hello
please try to use this code:
add_filter('woocs_raw_woocommerce_price', function($price) {
global $WOOCS;
if ('GBP' == $WOOCS->current_currency) {
return $price;
}
if (($price <= 100))
{
$price = round($price / 100, 0) * 100;
return $price;
} else
{
$price = ceil($price / 50) * 50;
return $price;
}
});
Hello
please try to use this code:
add_filter('woocs_raw_woocommerce_price', function($price) {
global $WOOCS;
if ('GBP' == $WOOCS->current_currency) {
return $price;
}
if (($price <= 100))
{
$price = round($price / 100, 0) * 100;
return $price;
} else
{
$price = ceil($price / 50) * 50;
return $price;
}
});
Quote from Jamie on July 29, 2022, 10:43@pavlo_borysenco
The hook you posted above works perfectly.
Thank you for all your hard work and support. :)
@pavlo_borysenco
The hook you posted above works perfectly.
Thank you for all your hard work and support. :)
Quote from Pablo Borysenco on July 29, 2022, 11:51Great! Welcome;)
Great! Welcome;)