I am trying to update cart item prices. Without double loop. Currently using:
foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item )
and:
$cart_item['data']->set_price( 0 );
I would like to change per item price based on number of items in the cart. for example if the person adds 5 items for 1$ each. on the 6th item I would like to change the price for all the items to .90 cents.
currently I am doing this in a double loop. first loop counts all the items and then the second sets the price based on the number of items.