Skip to content
Advertisement

Add a free shipping notice based on WooCommerce product price

I’m trying to make a custom code for two situations (considering both simple & variable products) :

  • 1 free shipping notice if the price is lower than 25 €
  • 1 free shipping notice if the price is higher than 25 €

This is my code attempt:

JavaScript

I don’t have enough experience, and it’s not working.

What I am doing wrong? Can someone help me to better achieve this?

Advertisement

Answer

The WC_Product Object $product need to be defined and you can merge both functions into one, for variable products and other product types, like:

JavaScript

Code goes in functions.php file of the active child theme (or active theme). Tested and works.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement