You can change the WooCommerce price to be by weight by appending some text after the actual price such as ‘per kg’, this can be done by manipulating 3 filters that display the price in the shop/product page, cart and checkout pages;


If all items were to be classified as ‘per kg‘ you could use the filters as below…

In the checkout filter I dropped the ‘per kg’ and just left ‘kg’ as the unit price is not used rather the total price.

woocommerce-checkout-weight woocommerce-by-weight



If you need more variations on the weight or to use a per item/unit options consider using ACF with a select field that can easily be changed per product.



  1. ciro on June 25, 2020 at 3:32 pm

    HI .. I need you same solutions. Have you solved? I have some products to sell by weight and some other by unit.
    How can I set the price by weight or by unit? Is there a Plugin?

  2. LeSScro on June 21, 2020 at 10:47 am

    Really appreciate. THX.

  3. Muzammil Abbas on June 21, 2020 at 5:43 am

    how to apply to a specific category?

  4. LeSScro on May 20, 2020 at 10:20 am


    it’s nice but if u have product without stock, then no price u just see per Kg ?
    Any fix for this configuration ?

    Nice piece of code anyway, very usefull.

    • Neil Gowran on May 21, 2020 at 6:01 am

      You could use conditionals on whether the stock is available or not

  5. Brì on September 15, 2018 at 3:20 pm

    What if I need to sell some products by weight but some other by unit?
    Thank you!

    • Neil Gowran on September 15, 2018 at 11:45 pm

      You could selectively choose products or product categories with conditional logic

      • Brì on September 16, 2018 at 10:04 am

        Hi Neil and thank you very much for your help! I will study this and try to do it by myself!
        Have a nice day!

      • Brì on September 16, 2018 at 10:27 am

        Hi Neil, sorry again. I’ve tried to edit the code you wrote up with an easy

        is_product_category( ‘shirts’ ) {}

        but it doesn’t work. I’m in the shop page or in the single product page but not in the archive of category. So I should be able to say to it that I’m speaking about the single category of the single product… Any advice?
        Really thank you for your time, it’s a huge help!

Leave a Comment