Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_action( 'woocommerce_cart_calculate_fees','new_customers_discount', 10, 1 );
- function new_customers_discount( $wc_cart ) {
- global $woocommerce;
- if (!empty($woocommerce->cart->applied_coupons)) {
- // discount percentage
- $percent = 6;
- // Calculation
- $discount = $wc_cart->cart_contents_total - $wc_cart->get_cart_discount_total * $percent / 100;
- // Add the fee (TAX third argument is disabled: false)
- $wc_cart->add_fee( __( 'Redemption Code Discount', 'woocommerce')." ($percent%)", -$discount, false );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement