<?php
/**
 * This is the default template for the
 * super-widget-checkout items loop.
 *
 * 
 * @version 1.1.0
 * @package IT_Exchange
 *
 * WARNING: Do not edit this file directly. To use
 * this template in a theme, copy over this file
 * to the exchange/super-widget-checkout/loops directory
 * located in your theme.
*/
?>
<?php do_action( 'ninja_shop_super_widget_checkout_before_items' ); ?>
<?php do_action( 'ninja_shop_super_widget_checkout_before_items_wrap' ); ?>
<div class="cart-items-wrapper">
	<?php do_action( 'ninja_shop_super_widget_checkout_begin_items_wrap' ); ?>

	<?php do_action( 'ninja_shop_super_widget_checkout_before_items_loop' ); ?>
	<?php while( it_exchange( 'cart', 'cart-items' ) ) : ?>
		<?php it_exchange_set_global( 'can_edit_purchase_quantity', it_exchange( 'cart-item', 'supports-purchase-quantity' ) && ( it_exchange_get_cart_products_count() < 2 ) ); ?>
		<?php do_action( 'ninja_shop_super_widget_checkout_begin_items_loop' ); ?>

		<?php
		foreach( it_exchange_get_template_part_elements( 'super-widget-checkout', 'items-loop', array( 'item' ) ) as $element ) :
			it_exchange_get_template_part( 'super-widget-checkout/elements/' . $element );
		endforeach;
		?>
		<?php do_action( 'ninja_shop_super_widget_checkout_end_items_loop' ); ?>
	<?php endwhile; ?>
	<?php do_action( 'ninja_shop_super_widget_checkout_after_items_loop' ); ?>

	<?php
	/**
	 * Loops we want to run inside the cart-items-wrapper but after the items loop
	 * If add-ons want to add to or remove from the loops that are included here,
	 * they can hook into the filter found inside it_exchange_get_template_part_loops
	*/
	$loops = array();

	if ( it_exchange( 'coupons', 'has-applied', array( 'type' => 'cart' ) ) )
		$loops[] = 'discounts';

	$loops[] = 'totals-taxes';

	if ( it_exchange_get_product_feature( it_exchange_get_the_product_id(), 'base-price' ) !== it_exchange_get_cart_total( false ) )
		$loops[] = 'cart-total';
	foreach( it_exchange_get_template_part_loops( 'super-widget-checkout', 'after-cart-items', $loops ) as $loop ) :
		it_exchange_get_template_part( 'super-widget-checkout/loops/' . $loop );
	endforeach;
	// End additional loops
	?>

	<?php do_action( 'ninja_shop_super_widget_checkout_end_items_wrap' ); ?>
</div>
<?php do_action( 'ninja_shop_super_widget_checkout_after_items_wrap' ); ?>
<?php do_action( 'ninja_shop_super_widget_checkout_after_items' ); ?>
