remove product from cart by id woocommerce

126

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 );
     }
}
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_meta', 40 );

Comments

Submit
0 Comments