WooCommerce
May 27, 2020

Change cart item prices based on custom cart item data in Woocommerce

We need to use 2 different hooks:

  • The first one just as yours without trying to change the price in it.
  • The second one where you will change your cart item price.

The code:

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

Related Post


Add Extra Tabs on WooCommerce Product Page

You need to add the code to your child theme’s functions.php file or via a plugin that allows custom functions to be added, such as the Code snippets plugin. Please don’t add custom code directly to your parent theme’s functions.php file as this will be wiped entirely when you update the theme. Use the following […]

Reordering Cross-Sells and Up-Sells in WooCommerce

Cross-sells and Up-sells in WooCommerce are a very powerful tool to give suggestions to your customers. You might know that most people who buy product A will probably need product B as well, and you want the customer to know that. How do you do it? You use cross-sells and up-sells. These products are shown […]

How to Change “Return to Shop” Button text in WooCommerce

Change “Return to Shop” Button text in WooCommerce a WordPress plugin this is quit easy to change it using gettext filter. If you are not using shop or name it something like back to home or store. Code goes in function.php file of your active child theme (or active theme).

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 […]

Editing product data tabs on WooCommerce Product Page

You need to add the code to your child theme’s functions.php file or via a plugin that allows custom functions to be added, such as the Code snippets plugin. Please don’t add custom code directly to your parent theme’s functions.php file as this will be wiped entirely when you update the theme. Removing Tabs Use […]

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).


Leave a Reply

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