在Woocommerce购物车中显示折扣前小计

时间:2019-01-13 13:28:15

标签: php wordpress woocommerce shopping-cart hook-woocommerce

如果使用促销代码或产品正在销售,我想在折扣前显示购物车小计。

当前,购物车总计中的小计显示了折扣后的小计,但是我需要在应用任何折扣之前显示小计。

基本上,我需要在woocommerce购物车中显示正常价格而不是销售价格

如果应用了优惠券,我只显示所需的小计代码。即使该产品在销售中,我也该怎么办?

   function slash_cart_subtotal_if_discount_Or_OnSale( $cart_subtotal, $compound, $obj ){
global $woocommerce;
if ( $woocommerce->cart->get_cart_discount_total() != 0  ) {
$new_cart_subtotal = wc_price( WC()->cart->subtotal - $woocommerce->cart->get_cart_discount_tax_total() - $woocommerce->cart->get_cart_discount_total() );
$cart_subtotal = sprintf( '<del>%s</del> <b>%s</b>', $cart_subtotal , $new_cart_subtotal );
}
return $cart_subtotal;

0 个答案:

没有答案
相关问题