</li>
	<?php 
            $h++;
        }
        ?>
</ul><!--/.products-->
<?php 
        $first = false;
    }
    ?>
</div>

<div class="items-in-cart 3u">
	<div id="in-cart">
		<?php 
    echo getItemsInCart();
    ?>
	</div>
	<div class="item-detail">
		<h3>Chopsticks</h3>
		<span class="price">£0.05</span>
	</div>
	<?php 
    if ($open) {
        ?>
		<div rel="nofollow" data-product_id="481" data-product_sku="chopsticks" data-quantity="1" class="ATC product_type_simple"><div class="button">Add to pair</div></div>

		<div class="checkout">
			<a href="<?php 
        echo site_url();
        ?>
Example #2
0
function AJ_delete_from_cart()
{
    global $woocommerce;
    // The $_REQUEST contains all the data sent via ajax
    if (isset($_REQUEST)) {
        $p_id = $_REQUEST['p_id'];
        $items = $woocommerce->cart->get_cart();
        foreach ($items as $cart_item_key => $values) {
            if ($values['product_id'] == $p_id) {
                $test = $woocommerce->cart->remove_cart_item($cart_item_key);
            }
        }
        echo getItemsInCart();
        // If you're debugging, it might be useful to see what was sent in the $_REQUEST
        // print_r($_REQUEST);
    }
    // Always die in functions echoing ajax content
    die;
}