@@ 921-935 (lines=15) @@ | ||
918 | return apply_filters( 'wpinv_cart_has_discounts', $ret ); |
|
919 | } |
|
920 | ||
921 | function wpinv_get_cart_discounted_amount( $items = array(), $discounts = false ) { |
|
922 | $amount = 0.00; |
|
923 | $items = !empty( $items ) ? $items : wpinv_get_cart_content_details(); |
|
924 | ||
925 | if ( $items ) { |
|
926 | $discounts = wp_list_pluck( $items, 'discount' ); |
|
927 | ||
928 | if ( is_array( $discounts ) ) { |
|
929 | $discounts = array_map( 'floatval', $discounts ); |
|
930 | $amount = array_sum( $discounts ); |
|
931 | } |
|
932 | } |
|
933 | ||
934 | return apply_filters( 'wpinv_get_cart_discounted_amount', $amount ); |
|
935 | } |
|
936 | ||
937 | function wpinv_get_cart_items_discount_amount( $items = array(), $discount = false ) { |
|
938 | $items = !empty( $items ) ? $items : wpinv_get_cart_content_details(); |
@@ 543-558 (lines=16) @@ | ||
540 | echo $total; |
|
541 | } |
|
542 | ||
543 | function wpinv_get_cart_tax( $items = array() ) { |
|
544 | $cart_tax = 0; |
|
545 | $items = !empty( $items ) ? $items : wpinv_get_cart_content_details(); |
|
546 | ||
547 | if ( $items ) { |
|
548 | $taxes = wp_list_pluck( $items, 'tax' ); |
|
549 | ||
550 | if( is_array( $taxes ) ) { |
|
551 | $cart_tax = array_sum( $taxes ); |
|
552 | } |
|
553 | } |
|
554 | ||
555 | $cart_tax += wpinv_get_cart_fee_tax(); |
|
556 | ||
557 | return apply_filters( 'wpinv_get_cart_tax', wpinv_sanitize_amount( $cart_tax ) ); |
|
558 | } |
|
559 | ||
560 | function wpinv_cart_tax( $items = array(), $echo = false ) { |
|
561 | $cart_tax = wpinv_get_cart_tax( $items ); |