WooCommerce
June 4, 2020

Remove Product From Cart Programmatically Woocommerce

We can remove product from WooCommerce cart using remove_cart_item() function with $product_id.

Code goes in function.php file of your active child theme (or active theme).

Related Post


Set cart item price from a hidden input field custom price in Woocommerce

First for testing purpose we add a price in the hidden input field as you don’t give the code that calculate the price: Then you will use the following to change the cart item price (WC_Session is not needed): Code goes in function.php file of your active child theme (or active theme). Tested and works.

Add Product to Cart if Cart Empty Woocommerce

We can add product to WooCommerce cart using add_to_cart() function with $product_id. Code goes in function.php file of your active child theme (or active theme).

How do I change the link of the Return to shop button WooCommerce?

WooCommerce default redirect on shop page when Cart is empty. The filter woocommerce_return_to_shop_redirect makes it easy to change Return to shop link. Code goes in function.php file of your active child theme (or active theme).

Add a select field that will change price in Woocommerce simple products

To add a select field in simple products (like in variable products) that will update base price depending on the dopdown selected value, try this: Code goes in function.php file of your active child theme (or active theme).

Add an Empty Cart button in WooCommerce

WooCommerce default not provide Empty Cart button but we can two simple steps to add Empty Cart button on cart page. The first one is to add below code in your functions.php file (this file is located in your theme folder): Second step is to add Empty Cart Button after Apply Coupon button. This code […]

How to disable all payment methods in WooCommerce

You will have the need to disable all payment gateways on the site, but just disabling them in WooCommerce > Settings > Payments will not work because then the customers will get an error message since there are no payment methods available. We’re going to be using a different method here. The way to go […]


Leave a Reply

Your email address will not be published. Required fields are marked *