@@ 647-653 (lines=7) @@ | ||
644 | $total = wpinv_get_cart_total( null, $discounts ); |
|
645 | $cart_totals = wpinv_recalculate_tax( true ); |
|
646 | ||
647 | if ( !empty( $cart_totals ) ) { |
|
648 | $response['success'] = true; |
|
649 | $response['data'] = $cart_totals; |
|
650 | $response['data']['code'] = $discount_code; |
|
651 | } else { |
|
652 | $response['success'] = false; |
|
653 | } |
|
654 | } else { |
|
655 | $errors = wpinv_get_errors(); |
|
656 | $response['msg'] = $errors['wpinv-discount-error']; |
|
@@ 678-684 (lines=7) @@ | ||
675 | $total = wpinv_get_cart_total( null, $discounts ); |
|
676 | $cart_totals = wpinv_recalculate_tax( true ); |
|
677 | ||
678 | if ( !empty( $cart_totals ) ) { |
|
679 | $response['success'] = true; |
|
680 | $response['data'] = $cart_totals; |
|
681 | $response['data']['code'] = $discount_code; |
|
682 | } else { |
|
683 | $response['success'] = false; |
|
684 | } |
|
685 | ||
686 | // Allow for custom discount code handling |
|
687 | $response = apply_filters( 'wpinv_ajax_discount_response', $response ); |