Selling fabric, flooring, and custom materials by length, area, or weight requires transparent unit pricing on the product page. The Measurement Price & Cost Calculator plugin for WooCommerce by Extendons lets customers enter their desired measurements and see an accurate total before checkout, eliminating price guessing and cart abandonment. The alternative is custom code, but a maintained plugin solution delivers the same result with less ongoing maintenance.
Why Measurement-Based Pricing Matters for Fabric and Flooring Stores
Static pricing quietly punishes stores that sell by the yard, meter, or square foot. A customer who needs 7.5 yards of upholstery fabric sees a product card showing only a base price with no way to calculate their total before checkout. Many will guess, add the wrong quantity, or leave entirely. The result is the same in every case: lost revenue and a support inbox full of "how much will this cost?" questions.
- Decision clarity: A live price-per-unit readout converts a hesitant shopper into a confident buyer.
- Checkout confidence: Customers who see the cost before adding to cart rarely abandon over price surprises.
- Fewer support tickets: Clear measurement input eliminates back-and-forth email chains about sizing.
- Higher order accuracy: Customers who enter exact measurements order the correct quantity the first time.
For a fabric store selling 20 different materials by length, the difference between guessing and knowing is usually the difference between a completed sale and a closed tab.
How to Sell Fabric by Length in WooCommerce
You have three viable paths: the WooCommerce price calculator plugin plugin, custom code, or manual quotes. The plugin is the fastest and requires no coding knowledge.
Method 1: Use the Measurement Price & Cost Calculator Plugin
Cost calculator for WooCommerce lets customers enter their desired measurements directly on the product page, and the price updates instantly before they add anything to the cart. No manual quotes, no back-and-forth emails, no abandoned orders waiting on a price.
The plugin handles length, area, volume, and weight, so fabric by the yard, carpet by the square foot, or rope by the meter all work the same way. It also manages stock by unit, prevents orders below your minimum cut, and applies tiered pricing automatically. Below are the steps to get it live on your store.
Step 1: Install and Activate the Plugin
You need the extension active before any product can use measurement pricing. The plugin is distributed as a .zip file, so installation follows the standard WordPress upload flow.
- Download the Measurement Price & Cost Calculator .zip file from your WooCommerce account.
- Go to WordPress Admin, click Plugins, then click Add New.
- Click Upload Plugin, select the .zip file you downloaded, then click Install Now.
- Click Activate once the installation completes.
You should now see the plugin listed under your active plugins, ready to configure.
Step 2: Change Your Product Type to Measurement
This step unlocks the measurement settings. A standard WooCommerce product cannot accept length inputs until you switch its type.
- Go to WooCommerce, click Products, then click the product you want to sell by length.
- Scroll down to Product Data and change the dropdown from Simple Product to Measurement.
- Click Save Product.
You should now see two new tabs: Measurement and Min/Max Quantity Value. These tabs hold every pricing and unit rule for that product.
Step 3: Configure Measurement Settings
Inside the Measurement tab, you will find the Measurement Settings sub-tab. This controls how the unit is measured and displayed to customers.
- Measurements: Choose your unit of measurement. Options include Weight, Length, Volume, and more.
- Show Product Price Per Unit: Check this box to display pricing per unit on the product page.
- Pricing Label: Set the label shown next to the unit price. For area units you can use m² or m³.
- Label: Add a custom label to display on the product page, such as "Enter your length."
- Entry Type: Choose free form or limited form. Free form works with min and max values you set.
- Input Unit: Select the unit customers use to enter their measurement, such as yards or meters.
- Manage stock: Check this box to track product stock based on the unit it is sold in.
- Output Unit: Choose the unit used to calculate the final price.
You should now see a working input field on the product page where customers can enter their desired length or area.
Step 4: Set Up the Pricing Table
The Pricing Table sub-tab defines the measurement ranges and their prices. This is where you set what customers actually pay for different quantities.
- Price: Set the base price for the product measurement. If a customer's quantity does not fall into any defined range, this minimum price applies.
- Minimum Quantity: Set the smallest quantity a customer must purchase.
- Maximum Quantity: Set the largest quantity a customer can purchase.
- Define your measurement ranges by creating rows with Price Per Unit and optional Sale Price Per Unit for each tier.
You should now see a working pricing structure on the product page, and customers can enter their length to get an instant total.
Method 2: Set Up a DIY Calculator Using WooCommerce Custom Fields and AJAX
For fabric stores with unusual pricing models, like tiered discounts based on total yardage or specific surcharges per color, a plugin may feel limiting. Building a custom solution gives you complete control, but it requires comfort with PHP, JavaScript, and WooCommerce hooks. This approach suits developers or stores with highly specific rules that are not worth forcing into generic software.
Step 1: Add Custom Input Fields to the Product Page
You need a visible field where customers type their desired length. The standard WooCommerce product page does not include one, so you must create it. Use the woocommerce_before_add_to_cart_button action hook to insert a number input into your product template.
- Hook: woocommerce_before_add_to_cart_button places your field directly above the Add to Cart button.
- Field type: Use a number input with min and max attributes to prevent unrealistic values.
- Unit label: Add a text label like "Yards" or "Meters" so customers know the measurement unit.
- Default value: Set a sensible default, such as 1, to avoid empty submissions.
You should now see a custom input field on every product page where the hook fires. This field is purely visual until you connect it to pricing logic.
Step 2: Store the Custom Value with PHP Hooks
The field value disappears during add-to-cart unless you tell WooCommerce to keep it. Attach a handler to the woocommerce_add_cart_item_data filter to save the length into the cart item. This filter receives the cart item array, so you can append your custom value alongside product ID and quantity.
Validate the submitted value server-side here, not just in the browser. Check it is numeric, respect your minimum and maximum limits, and fall back to a default if the input is empty. Never trust client-side validation alone, because crafty users can bypass it.
You should now see the custom length stored inside the cart item data after a product is added. This data persists through checkout and appears in the order details.
Step 3: Calculate Price Per Unit and Update the Cart Total
Multiply the stored length by your per-unit price to get the line total. Hook into woocommerce_before_calculate_totals, loop through each cart item, and set a new price using the set_price() method. This method overrides the default product price for that specific cart item.
Apply your tiered pricing rules here if you have them. For example, charge $4 per yard for the first 10 yards and $3.50 per yard beyond that. Fetch the product's regular price, apply your logic, and assign the computed value to the cart item.
You should now see the cart total update when a customer adds their measured fabric. The per-unit math happens server-side, so the final price is always consistent with your rules.
Step 4: Use AJAX for Real-Time Price Updates
The previous steps calculate the price when the product is added to the cart. To show the cost before that moment, you need AJAX. Create a JavaScript handler that listens for input changes on your custom field, sends the value to the server, and receives the calculated price back.
Build an AJAX endpoint using wp_ajax_nopriv_ and wp_ajax_ actions, then return the computed price as JSON. On the frontend, update a price display element with the response. Debounce the input event so you do not fire a request on every keystroke.
You should now see the price update live on the product page as the customer types a length. They know the exact cost before adding the item, which removes a major barrier to checkout.
This method is powerful but carries ongoing maintenance costs. WooCommerce updates can change hook names or behavior, so you must test the code after every core update. For most stores, a maintained solution like the Measurement Price & Cost Calculator plugin delivers the same result with less upkeep.
Troubleshooting: Common Calculator Issues and Fixes
Even a well-configured measurement calculator can go quiet. Here are the most common problems fabric and flooring sellers hit, plus the fixes that get the calculator responding again.
If the calculator does not appear on the product page
Start by confirming the product type is set to Measurement, not Simple Product. If it is correct, check that the plugin is active under Plugins, then clear any caching plugin you use. Stale cached pages are the most common reason a newly configured calculator stays invisible to shoppers.
If the price does not update when a customer changes the length
This usually points to a unit mismatch in the Measurement Settings. Confirm the Input Unit matches the unit your customer selects on the frontend. Also check that you saved a Price Per Unit in the Pricing Table. If the product falls outside every range you defined, the plugin falls back to the minimum price.
If tiered pricing does not apply at certain quantities
The Pricing Table applies the range that contains the customer's entered quantity. If a customer buys 5.5 yards and your ranges jump from 5 to 6, that value does not fit either range, so the minimum price applies. Tighten your ranges so every realistic quantity lands inside one.
If the page throws AJAX errors or the cart behaves oddly
AJAX failures usually come from a conflict with another plugin or your theme. Disable other plugins one at a time and reload the product page to find the offender. Confirm your server runs PHP 7.4.0 or newer, plus current WordPress and WooCommerce versions.
Conclusion
Measurement-based pricing removes the guesswork from fabric and flooring sales. By letting customers enter their exact dimensions and see the cost before checkout, you eliminate price surprises, reduce support emails, and recover sales that would have abandoned otherwise.
Cost calculator for WooCommerce is the fastest path to this outcome. It handles all the math, validation, and tiered pricing automatically, so you can focus on your products instead of wrestling with custom code. Install it, switch your product to Measurement type, set your pricing table, and you are done. Start with one product to test the workflow, then roll it out across your entire catalog.


30-day money back guarantee
Dedicated Support Team
Safe & Secure Free Update
Safe Customized Solutions