Skip to content
Advertisement

Enable decimal quantities and stock for WooCommerce products

I want to change the default quantity from the products, from 1 to 0,1 but I can’t seem to figure it out.

I tried the following:

JavaScript

The problem with this is that modifies the quantity input from cart as well, which isn’t what I want.

To be more specific I want the following:

  1. when I go to the product page I want to show 0,1;
  2. when I go to the cart page I want to show the current quantity;

The solution I mention above shows 0,1 both in product page and in cart page.
I found another solution, but it shows the current quantity both in product and in cart which, again, it’s not what I want.

Any ideas?

Advertisement

Answer

Based on Decimal quantity step for specific product categories in WooCommerce answer code, try the following revisited code:

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
9 People found this is helpful
Advertisement