Advertisement
imnguyen

GACO: negative tax fee

Feb 16th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1.  
  2. add_action( 'woocommerce_cart_calculate_fees','new_customers_discount', 10, 1 );
  3. function new_customers_discount( $wc_cart ) {
  4.  
  5. global $woocommerce;
  6. if (!empty($woocommerce->cart->applied_coupons)) {
  7.  
  8. // discount percentage
  9. $percent = 6;
  10.  
  11. // Calculation
  12. $discount = $wc_cart->cart_contents_total - $wc_cart->get_cart_discount_total * $percent / 100;
  13.  
  14. // Add the fee (TAX third argument is disabled: false)
  15. $wc_cart->add_fee( __( 'Redemption Code Discount', 'woocommerce')." ($percent%)", -$discount, false );
  16. }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement