Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

remove product from cart by id woocommerce

foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
     if ( $cart_item['product_id'] == $your_product_id_here ) {
          WC()->cart->remove_cart_item( $cart_item_key );
     }
}
Source by wpza.net #
 
PREVIOUS NEXT
Tagged: #remove #product #cart #id #woocommerce
ADD COMMENT
Topic
Name
1+1 =