How to show “regular price” instead of a “discount

2019-07-10 00:00发布

问题:

I have read like every single topic about woocommerce but cannot find out how to show regular price instead of a discounted price on mini-cart. (Yes, i want to show regular price in mini-cart.php)

I think i should modify mini-cart.php:41 but i dont know how i can show regular price.

$product_price     = apply_filters( 'woocommerce_cart_item_price', WC()->cart->get_product_price( $_product ), $cart_item, $cart_item_key );

Can someone help me with this one?

回答1:

Try this:

$product_price     = apply_filters( 'woocommerce_cart_item_price', WC()->cart->get_regular_price( $_product ), $cart_item, $cart_item_key );


回答2:

Yes i used this on mini-cart.php:41 and worked!

apply_filters( 'woocommerce_get_regular_price', $_product->get_regular_price(), $cart_item, $cart_item_key );