3
votes

I am new to woocommerce. Recently I am trying to develop a e-commerce site with woocommerce plugin. But the problem is , when I want to delete a single product from cart all products are deleted from cart. I used the code below to remove from cart

 <a id="empty_cart" class="button" href="<?php echo $woocommerce->cart->get_cart_url();   ?>?empty-cart"><?php _e( 'Empty Cart', 'woocommerce' ); ?></a> 

But I dont know which code should I use to remove products which I want to remove. Not whole products. Please help me.

1

1 Answers

4
votes

You may find some help here: http://docs.woothemes.com/wc-apidocs/class-WC_Cart.html http://docs.woothemes.com/wc-apidocs/package-WooCommerce.Functions.html

Try with this:

<?php
    echo apply_filters( 
        'woocommerce_cart_item_remove_link', 
        sprintf( 
            '<a href="%s" class="remove" title="%s">&times;</a>', 
            esc_url( $woocommerce->cart->get_remove_url( $cart_item_key ) ), 
            __( 'Remove this item', 'woocommerce' ) 
        ), 
        $cart_item_key 
    );
?>