How to sell by weight in WooCommerce – the complete guide

Sell by weight in WooCommerce graphic

By default, WooCommerce doesn’t provide you an easy way to sell by weight. In this article we’ll look at three simple methods to sell your products by weight rather than quantity.

There are many types of online stores that sell products by weight rather than unit, including:

  • Grocery stores selling fruit and other items by weight
  • Online butchers selling meat
  • Delicatessens selling fresh and dried goods
  • Precious metals like gold or silver
  • Confectionery shops
  • And many more

This article should apply to any kind of product where you want to allow the user to specify the weight they want.

Let’s start with a quick intro to how WooCommerce allows you to set product weight – then we’ll look at three different methods to sell by weight.

Where to define your site’s units of weight

In WooCommerce, every physical product can be assigned a weight (and other dimensions like length, width, etc). This is especially important when calculating shipping.

You can define your site’s unit of weight in the measurements section in WooCommerce > Settings > Products > General.

WooCommerce measurements setting

Here you can see that our site’s default weight unit is kilograms.

How to set product weight in WooCommerce

Once you’ve defined your site’s weight unit, you can set weights for each of your products. To do so, click on the ‘Shipping’ tab in the ‘Product data’ section.

WooCommerce product weight setting

Now you’ve defined a set weight for this product of 5kg. If the user adds this product to their cart, the total weight of the cart will increase by 5kg. You can use this value when setting shipping costs.

But this isn’t quite the same as selling by weight. It just means that you’re assigning a weight to a single item – the user is still buying by quantity.

So let’s look at three ways to sell by weight in WooCommerce.

Tutorial 1: How to sell foodstuffs by weight using WooCommerce variable products

It is still possible to use default WooCommerce functionality to sell by weight in WooCommerce – although, as we’ll see, this method is limited to offering users only a few weights to choose from.

WooCommerce sell by weight - variations

In the screenshot above, you can see that we’ve got a variable product with three options: 500g, 1kg and 2kg. The user chooses the weight they want, the product is added to the cart, and the overall cart weight is updated.

This is easy enough to set up.

1. Create a variable product

First, create your variable product with a variation for each weight that you’re selling. In our example, there are just three variations – 500g, 1kg and 2kg.

2. Enter weights per variation

Once you’ve created your variations, you just enter weights for each one – as in the screenshot below. That’s enough to provide limited weight-based sales in WooCommerce.

Set weights for variations in WooCommerce

Now, the user can select an option based on its weight.

This is fine as far as it goes but how do you allow the user to enter specific weights rather than just choosing from a pre-defined list?

Tutorial 2: How to sell meat by weight in WooCommerce

In this example, we’ll look at how to sell meat by weight. This can be applied to any type of weight-based product.

Sell meat by weight in WooCommerce

This is more flexible than the first tutorial. It allows the user to enter the weight they require in a quantity field.

For this, you’ll need a plugin. The WooCommerce Product Add-Ons Ultimate plugin allows you to add different input fields to your products.

WooCommerce Product Add-Ons Ultimate featured image

WooCommerce Product Add-Ons Ultimate

Personalise products with extra fields and custom options

Find Out More

This means that you can replace the default WooCommerce quantity field with a number input field where the user can enter the required weight of product. Let’s look at how to create that.

Read more about how to add custom product options to WooCommerce products here.

1. Add a custom field for the required weight

Once you’ve installed and activated Add-Ons Ultimate, you can add a new field to your product. Edit the product that you’d like to sell by weight and click on the ‘Product Add-Ons’ tab in the ‘Product data’ section.

Click ‘Add group’ then ‘Add field’.

Choose ‘Number’ in the ‘Field Type’ setting and enter a label in the ‘Field Label’ setting. This will now display a field on the product page where the user can enter their weight.

2. Setting the price per weight

Because the weight determines the price, we need to specify another couple of settings. In ‘Field Price’ enter the price of the product per unit. In this example, our steak costs $25/kg so we just enter ’25’ in ‘Field Price’.

And because we want to multiply the price by the weight, check the ‘Multiply Price’ option. This means that the price of the field will be the field price multiplied by the weight entered by the user in the field. So if the user wants 2.5kg of steak, that will be 2.5 multiplied by 25 which equals $62.50.

You can see this working on the demo product here.

3. Set the price label to show price per unit

Most sites selling by weight will want to show the user what the price of the product is per unit of weight. We can do that by updating the main product price label in WooCommerce to show the price per kilo.

On the ‘General’ tab, enter ‘0’ as the ‘Regular price’ – it’s zero because the price is getting set dynamically by the add-on field.

To help the user, we can update the main product price label with the price per kilo. So in this case we’ve entered ‘$25 per kg’ in the ‘Price label’ field. Finally, set ‘Price label display’ to ‘Hide price’. This will display our price per weight information.

WooCommerce product price by weight

Then, when the user enters their weight, the price is updated dynamically.

WooCommerce sell by weight - dynamic price

4. Hide the default quantity field

You might notice in the screenshot above that there’s no quantity field next to the ‘Add to cart’ button. We don’t need a quantity field because we’re specifying the weight using our custom field.

To hide the default WooCommerce quantity field, click on the ‘Inventory’ tab in the ‘Product data’ section. Then check the ‘Sold individually’ option. This will hide the quantity field on the front end.

WooCommerce sold individually setting

5. Setting the number of decimal places for the weight setting

In our example, the customer can enter the weight of steak required to 2 decimal places. You can control this using the ‘Decimal places’ setting.

You can enter any value you like here to determine the number of decimal places you wish to accept for your weight measurement.

6. Setting minimum and maximum weights

If you’d like to place restrictions on how little or how much of your product that a user can buy, you can set a ‘Min Value’ and/or ‘Max Value’.

WooCommerce minimum and maximum weight value

So that’s a simple way to sell products by weight in WooCommerce. You just need to add a single add-on field where the user can enter the weight they want. Now let’s look at a more advanced example.

Tutorial 3: How to sell coffee by weight in WooCommerce

This tutorial is similar to the previous one. We can use a number field for the user to enter their desired weight but we’ll use a calculation field to calculate the price. We’ll also dynamically set the product weight so that shipping costs can be calculated.

WooCommerce sell coffee by weight

You can view the demo product here.

Once again, you’ll need the Product Add-Ons Ultimate plugin for this. In this case, you’ll need the Pro version as we’ll use a feature that’s only available in that version.

WooCommerce Product Add-Ons Ultimate featured image

WooCommerce Product Add-Ons Ultimate

Personalise products with extra fields and custom options

Find Out More

1. Add a custom field for the required weight

Once you’ve installed and activated Add-Ons Ultimate, you can add a new field to your product. Edit the product that you’d like to sell by weight and click on the ‘Product Add-Ons’ tab in the ‘Product data’ section.

Click ‘Add group’ then ‘Add field’.

WooCommerce weight based input field

This is similar to Tutorial 2 above, but we don’t need to enter a price. Instead, we’re going to set the price using a calculation.

2. Setting raw material prices

Many stores might have a single raw material – in this case, coffee – that is sold in multiple ways in different products. So you might want to have a single place where you can define the base raw material cost then use that in multiple products. This is especially helpful if your raw material costs change frequently – you only need to update them in one place.

With Add-Ons Ultimate, you can do this with global variables. Go to WooCommerce > Settings > Product Add-Ons > Calculations and enter a value in one of the ‘Variable’ fields. There are three by default but you can increase this to as many as you like.

WooCommerce raw material prices

In our example, we’re entering a raw material value for our coffee of 50 in the ‘Variable 1’ field.

3. Setting price by weight using a calculation

Now we can create a field that will calculate the price by weight. Add another field to your product and choose ‘Calculation’ as the field type. This allows you to calculate a value based on multiple factors including user inputs and global variables.

In the ‘Formula’ field, enter your formula. In this case, we’re going to multiply the weight input by the user and the raw material cost, like this:

{variable_1} * {field_3385}

{variable_1} represents the value of our raw material and {field_3385} represents the value input by the user in the ‘Weight’ field.

WooCommerce calculation field - multiply weight by raw material cost

In the ‘Action’ setting, you can choose ‘Set Product Price’. This will set the product price based on the value of the calculation. Check out the demo product and see how the price is updated when you enter a value in the weight field.

4. Dynamically setting the product weight

This step is essential if you are using weight-based shipping.

Create another calculation field. In the ‘Formula’ field you just want to pull in the value from the weight input field. In our example, this is simply:

{field_3385}

Then you need to set ‘Action’ to ‘Add to Product Weight’. This will now add the calculation result to the overall product weight.

Set product weight dynamically in WooCommerce

Your shipping calculator will now be able to use the product weight to calculate costs.

Selling by weight in WooCommerce – recap

Hopefully these three short tutorials have shown you how you can effectively sell by weight in your WooCommerce store. Although it’s possible to sell by weight just using variable products, you need WooCommerce Product Add-Ons Ultimate to allow user-specified weights.

WooCommerce Product Add-Ons Ultimate featured image

WooCommerce Product Add-Ons Ultimate

Personalise products with extra fields and custom options

Find Out More

Any questions? Leave a comment and we’ll get back to you.

Leave a Reply

Your email address will not be published. All fields are required.