admin管理员组文章数量:1130349
I need to show a discounted sum as a percentage of regular price using in WooCommerce. Original and stroked price + discounted price (of 10%).
Eg.: 100 90
I've tried a lot of plugins and they discount effectively, but I need to SHOW to customers (in product and category pages) the original sum (regular price) and the discounted price (the real prices are already managed by a rental plugin).
I need to show a discounted sum as a percentage of regular price using in WooCommerce. Original and stroked price + discounted price (of 10%).
Eg.: 100 90
I've tried a lot of plugins and they discount effectively, but I need to SHOW to customers (in product and category pages) the original sum (regular price) and the discounted price (the real prices are already managed by a rental plugin).
Share Improve this question edited Dec 6, 2018 at 13:57 butlerblog 5,1413 gold badges28 silver badges44 bronze badges asked Dec 19, 2017 at 16:10 ArDiEmArDiEm 411 silver badge5 bronze badges1 Answer
Reset to default 1Ok, maibe I got it:
add_filter('woocommerce_get_price_html', 'custom_price', 10, 2);
function custom_price( $price, $product ) {
$price = 'from ';
$price .= '<del>' . woocommerce_price($product->regular_price *= 1) . '</del> ';
$price .= woocommerce_price($product->regular_price *= 0.9);
$price .= ' per day';
return $price;
}
I need to show a discounted sum as a percentage of regular price using in WooCommerce. Original and stroked price + discounted price (of 10%).
Eg.: 100 90
I've tried a lot of plugins and they discount effectively, but I need to SHOW to customers (in product and category pages) the original sum (regular price) and the discounted price (the real prices are already managed by a rental plugin).
I need to show a discounted sum as a percentage of regular price using in WooCommerce. Original and stroked price + discounted price (of 10%).
Eg.: 100 90
I've tried a lot of plugins and they discount effectively, but I need to SHOW to customers (in product and category pages) the original sum (regular price) and the discounted price (the real prices are already managed by a rental plugin).
Share Improve this question edited Dec 6, 2018 at 13:57 butlerblog 5,1413 gold badges28 silver badges44 bronze badges asked Dec 19, 2017 at 16:10 ArDiEmArDiEm 411 silver badge5 bronze badges1 Answer
Reset to default 1Ok, maibe I got it:
add_filter('woocommerce_get_price_html', 'custom_price', 10, 2);
function custom_price( $price, $product ) {
$price = 'from ';
$price .= '<del>' . woocommerce_price($product->regular_price *= 1) . '</del> ';
$price .= woocommerce_price($product->regular_price *= 0.9);
$price .= ' per day';
return $price;
}
本文标签: Apply a discount percentage to regular price WooCommerce by function
版权声明:本文标题:Apply a discount percentage to regular price WooCommerce by function 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://it.en369.cn/questions/1749123750a2319433.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。


发表评论