@@ 923-937 (lines=15) @@ | ||
920 | return apply_filters( 'wpinv_cart_has_discounts', $ret ); |
|
921 | } |
|
922 | ||
923 | function wpinv_get_cart_discounted_amount( $items = array(), $discounts = false ) { |
|
924 | $amount = 0.00; |
|
925 | $items = !empty( $items ) ? $items : wpinv_get_cart_content_details(); |
|
926 | ||
927 | if ( $items ) { |
|
928 | $discounts = wp_list_pluck( $items, 'discount' ); |
|
929 | ||
930 | if ( is_array( $discounts ) ) { |
|
931 | $discounts = array_map( 'floatval', $discounts ); |
|
932 | $amount = array_sum( $discounts ); |
|
933 | } |
|
934 | } |
|
935 | ||
936 | return apply_filters( 'wpinv_get_cart_discounted_amount', $amount ); |
|
937 | } |
|
938 | ||
939 | function wpinv_get_cart_items_discount_amount( $items = array(), $discount = false ) { |
|
940 | $items = !empty( $items ) ? $items : wpinv_get_cart_content_details(); |
@@ 764-779 (lines=16) @@ | ||
761 | echo $total; |
|
762 | } |
|
763 | ||
764 | function wpinv_get_cart_tax( $items = array() ) { |
|
765 | $cart_tax = 0; |
|
766 | $items = !empty( $items ) ? $items : wpinv_get_cart_content_details(); |
|
767 | ||
768 | if ( $items ) { |
|
769 | $taxes = wp_list_pluck( $items, 'tax' ); |
|
770 | ||
771 | if( is_array( $taxes ) ) { |
|
772 | $cart_tax = array_sum( $taxes ); |
|
773 | } |
|
774 | } |
|
775 | ||
776 | $cart_tax += wpinv_get_cart_fee_tax(); |
|
777 | ||
778 | return apply_filters( 'wpinv_get_cart_tax', wpinv_sanitize_amount( $cart_tax ) ); |
|
779 | } |
|
780 | ||
781 | function wpinv_cart_tax( $items = array(), $echo = false ) { |
|
782 | $cart_tax = wpinv_get_cart_tax( $items ); |