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