decimal increment

Topic summary

A user selling fabric on Shopify with the Woodmart theme needs decimal quantity increments (e.g., 0.5 meters), but the cart only adds whole units despite implementing decimal input fields.

Core Challenge:
Shopify’s native inventory system only supports whole numbers, creating a fundamental limitation for selling fabric by length.

Proposed Solutions:

  1. Line Item Properties Approach: Hide the default quantity selector, create a custom decimal input saved as line item properties, store per-unit pricing in metafields, and use JavaScript to calculate the actual cart quantity based on length × unit price. This requires custom coding but works within Shopify’s constraints.

  2. Smallest Unit Pricing: Price fabric by the smallest sellable unit (e.g., 1/8 yard = 1 unit), so ordering 5 yards = 40 units. This scales pricing automatically using whole numbers.

  3. App Solution: The “Measura: Sell by Weight & More” app specifically handles decimal quantities and inventory for fabric/length-based products, with built-in min/max controls.

  4. Advanced Option: Develop a custom app using Shopify Functions Cart Transform API for dynamic price calculations.

The discussion remains open with multiple participants offering to assist with custom implementation.

Summarized with AI on October 29. AI used: claude-sonnet-4-5-20250929.

I am using woodmart theme and i am selling fabric so for that i need decimal increment i am able to do decimal increments but when i click on add to cart it adding only 1.

1 Like

@Tasbeel

In Shopify, inventory can only be managed using natural numbers. Therefore, for selling fabric, it is recommended to set the order quantity to “1” and use a line item property to specify the fabric length.

Additionally, you can link line item properties with the product’s metafields to construct theoretical inventory. By triggering Shopify Flow upon order creation, you can update the inventory metafields to effectively manage stock.

For more advanced requirements, installing a Shopify app or implementing a custom app will be necessary.

Reference: Line Item Property Generator → You can create an input tag to set the fabric length.

I want same like this
https://fabrics-fabrics.com/products/floral-towers-border-pattern-printed-silk-shantung-bridal-peach-pinks-tangerine-purples-designer-fashion-fabrics-19724?variant=45721896386818

1 Like

OK.

The quantity input field displayed on this site is not directly tied to the quantity field. The quantity field is hidden, and the following steps can be implemented to achieve a similar functionality:

1.Hide the default quantity selector

Hide Shopify’s default quantity change buttons.

2.Create a custom quantity selector and register it in line item properties

Build a custom quantity selector and save its input value to the line item properties.

3.Set the price per unit length in the product variant metafield

Add a metafield to the product variant to store the price per unit length.

4.Implement JavaScript to calculate the allocated quantity based on the custom selector

When the custom quantity selector is changed, use JavaScript to calculate the allocated quantity (name=“quantity”) based on the price per unit length and send it to the backend. → for example, fetch cart change endpoint ( https://shopify.dev/docs/api/liquid/objects/routes#routes-cart_change_url )

As a reference, the checkout page on this site displays the calculated item count (allocated quantity).

can you help me to do this?

sure :bird:

collaborate to help you

t.besham@gmail.com please contact me here

1 Like

thx! contact later.

1 Like

hi @Tasbeel

this can be done with custom code

Bottom line:

To dynamically change prices, you need to use a public app or develop a custom app that uses the shopify functions cart transform api. If it is not used, either prepare different lengths or replace it by linking reserved stock according to the length.

Another option is to adjust the price you are selling to the smallest unit size then a person orders however much they need. For instance you price 1/8th a yard at $X.XX price and this is 1 unit, then as someone orders 1 yard that would be 8 units, 5 yards would be 40 units etc. the price scales up by the base smallest unit and you can still use Shopify whole numbers.

hi there are 2 options

option 1 you can add decimal as variants option 2 this can be done with custom coding let’s discuss further if you plan for custom coding

Hi @Tasbeel ,

You can use the app Measura: Sell by Weight & More to sell fabric with decimal increments on your website. It can also handle min/max length. Inventory will be stored as decimal quantities as well (e.g., 10.25 meters in stock).

You can set it up this way:

  1. Choose products that you need to sell by length

  2. Set the min/max length, and also the decimal increments

  3. Add the app block to your website

Demo:

App settings: