quantity selector increement 0.5 in product page doesn't update in cart

I have added a snippet in this way in main_product.liquid page.

<input class=“quantity__input”
type=“number”
name=“quantity”
id=“Quantity-{{ section.id }}”
min=“0.5”
max=“{{ product.selected_or_first_available_variant.inventory_quantity}}”
value=“0.5”
step=“0.5”
form=“{{ product_form_id }}”

The quantity selected in decimal isn’t getting updated in cart page. And the price also doesn’t get updated. Kindle help! THANK YOU

Hey mate!

Unfortunately the quantity has to be an integer, so 0.5 won’t work. You have to increase the quantity by a whole number.

What is the use case of adding a product in increments of half an item? There may be a workaround but unsure what you are trying to achieve. Could you set the product price to be 50% and then use whole numbers for the quantity? You would want to express this to the user though so they don’t get confused. If you have a link pass it through :grinning_face:

Hey! Thank you for the response. My store is based on fabrics. I need to sell them in meters. So i want options such as 0.5m, 1m etc. Is there any other way(except variants) through which i can achieve this?

Okay, that makes a bit more sense. Thank you for sharing.

My advice would be to rename the products to contain 0.5m lengths, for example, 0.5m Egyptian Cotton. That way when the user has selected a quantity of 2, it would be 1m of the fabric.

Depending on your coding knowledge, you could add an event listener to the quantity change and show the total fabric to the user. That would clear up any confusion the user might have.

I hope that help!!

Now my store is working on that method itself. I did specify 0.5 cotton and its price (same as you said). I want a better quantity selector for better working and understanding.

my store: https://antriksh.thefolkfair.com/

Hello DevoloperCZ sir,
I hope you’re well. I’m also facing the same issue you can share the code so I can fix my problem?
Thank you

Hey @Ashi1410 , I added it in the form of Dropdown menu.
Here is the code:

Hello @DevoloperCZ sir,

Thank you for your reply

Can you please guide me on where I must update this code so that my quantity selector works like 0.5,1,1.5,2,2.5 etc?
(I’m using Impulse theme)
thank you

Hey @Ashi1410 , the code must be updated in product and cart page.

product-quantity.liquid and cart.liquid. I need to know if you have these files in your code.

No sir

I have these files

Then place it in main-product.liquid

Where? at the end?

after updating this code quantity is still not update

Replace it with quantity input here

sir if you don’t mind may I know your email id so that I can share you the code of my website

Hello DevoloperCZ sir,
I’m sharing the code kindly add 0.5 , 1 , 1.5 , 2, 2.5 etc code into it.
Thank you

{%- liquid
assign isModal = false
if template == ‘product.modal’
assign isModal = true
endif
-%}

{%- render ‘product-template’,
product: product,
section_id: section.id,
blocks: section.blocks,

image_position: section.settings.image_position,
image_container_width: section.settings.image_size,
product_zoom_enable: section.settings.product_zoom_enable,
sku_enable: section.settings.sku_enable,
isModal: isModal,
thumbnail_position: section.settings.thumbnail_position,
thumbnail_arrows: section.settings.thumbnail_arrows,
mobile_layout: section.settings.mobile_layout,
video_looping: section.settings.enable_video_looping,
video_style: section.settings.product_video_style
-%}

{% schema %}
{
“name”: “t:sections.main-product.name”,
“settings”: [
{
“type”: “checkbox”,
“id”: “sku_enable”,
“label”: “t:sections.main-product.settings.sku_enable.label”
},
{
“type”: “header”,
“content”: “t:sections.main-product.settings.header_media”
},
{
“type”: “paragraph”,
“content”: “t:sections.main-product.settings.content”
},
{
“type”: “select”,
“id”: “image_position”,
“label”: “t:sections.main-product.settings.image_position.label”,
“default”: “left”,
“options”: [
{
“value”: “left”,
“label”: “t:sections.main-product.settings.image_position.options.left.label”
},
{
“value”: “right”,
“label”: “t:sections.main-product.settings.image_position.options.right.label”
}
]
},
{
“type”: “select”,
“id”: “image_size”,
“label”: “t:sections.main-product.settings.image_size.label”,
“default”: “medium”,
“options”: [
{
“value”: “small”,
“label”: “t:sections.main-product.settings.image_size.options.small.label”
},
{
“value”: “medium”,
“label”: “t:sections.main-product.settings.image_size.options.medium.label”
},
{
“value”: “large”,
“label”: “t:sections.main-product.settings.image_size.options.large.label”
}
]
},
{
“type”: “checkbox”,
“id”: “product_zoom_enable”,
“label”: “t:sections.main-product.settings.product_zoom_enable.label”,
“default”: true
},
{
“type”: “select”,
“id”: “thumbnail_position”,
“label”: “t:sections.main-product.settings.thumbnail_position.label”,
“default”: “beside”,
“options”: [
{
“value”: “beside”,
“label”: “t:sections.main-product.settings.thumbnail_position.options.beside.label”
},
{
“value”: “below”,
“label”: “t:sections.main-product.settings.thumbnail_position.options.below.label”
}
]
},
{
“type”: “checkbox”,
“id”: “thumbnail_arrows”,
“label”: “t:sections.main-product.settings.thumbnail_arrows.label”
},
{
“type”: “select”,
“id”: “mobile_layout”,
“label”: “t:sections.main-product.settings.mobile_layout.label”,
“default”: “partial”,
“options”: [
{
“value”: “partial”,
“label”: “t:sections.main-product.settings.mobile_layout.options.partial.label”
},
{
“value”: “full”,
“label”: “t:sections.main-product.settings.mobile_layout.options.full.label”
}
]
},
{
“type”: “checkbox”,
“id”: “enable_video_looping”,
“label”: “t:sections.main-product.settings.enable_video_looping.label”,
“default”: true
},
{
“type”: “select”,
“id”: “product_video_style”,
“label”: “t:sections.main-product.settings.product_video_style.label”,
“default”: “muted”,
“options”: [
{
“value”: “muted”,
“label”: “t:sections.main-product.settings.product_video_style.options.muted.label”
},
{
“value”: “unmuted”,
“label”: “t:sections.main-product.settings.product_video_style.options.unmuted.label”
}
],
“info”: “t:sections.main-product.settings.product_video_style.info”
}
],
“blocks”: [{
“type”: “@app
},
{
“type”: “price”,
“name”: “t:product_block.price.name”,
“limit”: 1
},
{
“type”: “quantity_selector”,
“name”: “t:product_block.quantity_selector.name”,
“limit”: 1
},
{
“type”: “size_chart”,
“name”: “t:product_block.size_chart.name”,
“limit”: 1,
“settings”: [
{
“type”: “page”,
“id”: “size_chart”,
“label”: “t:product_block.size_chart.settings.page.label”
}
]
},
{
“type”: “image_picker”,
“name”: “Icon Image”,
“limit”: 5,
“settings”: [
{
“type”: “image_picker”,
“id”: “product_img”,
“label”: “Enter the image”
},
{
“type”: “text”,
“id”: “prod_icons”,
“label”: “Enter the text”
}
]
},
{
“type”: “variant_picker”,
“name”: “Variant picker”,
“limit”: 1,
“settings”: [
{
“type”: “checkbox”,
“id”: “variant_labels”,
“label”: “t:product_block.variant_picker.settings.variant_labels.label”,
“default”: true
},
{
“type”: “select”,
“id”: “picker_type”,
“label”: “t:product_block.variant_picker.settings.picker_type.label”,
“options”: [
{
“value”: “button”,
“label”: “t:product_block.variant_picker.settings.picker_type.options.button.label”
},
{
“value”: “dropdown”,
“label”: “t:product_block.variant_picker.settings.picker_type.options.dropdown.label”
}
],
“default”: “button”
},
{
“type”: “checkbox”,
“id”: “color_swatches”,
“label”: “Enable color swatches”,
“info”: “Requires type to be set to ‘Buttons’. Learn how to set up swatches
}
]
},
{
“type”: “description”,
“name”: “t:product_block.description.name”,
“limit”: 1,
“settings”: [
{
“type”: “checkbox”,
“id”: “is_tab”,
“label”: “t:product_block.description.settings.is_tab.label”
}
]
},
{
“type”: “buy_buttons”,
“name”: “t:product_block.buy_buttons.name”,
“limit”: 1,
“settings”: [
{
“type”: “checkbox”,
“id”: “show_dynamic_checkout”,
“label”: “t:product_block.buy_buttons.settings.show_dynamic_checkout.label”,
“info”: “t:product_block.buy_buttons.settings.show_dynamic_checkout.info”,
“default”: true
},
{
“type”: “checkbox”,
“id”: “surface_pickup_enable”,
“label”: “t:product_block.buy_buttons.settings.surface_pickup_enable.label”,
“info”: “t:product_block.buy_buttons.settings.surface_pickup_enable.info”,
“default”: true
}
]
},
{
“type”: “inventory_status”,
“name”: “t:product_block.inventory_status.name”,
“limit”: 1,
“settings”: [
{
“type”: “range”,
“id”: “inventory_threshold”,
“label”: “t:product_block.inventory_status.settings.inventory_threshold.label”,
“default”: 10,
“min”: 0,
“max”: 20,
“step”: 2
},
{
“type”: “checkbox”,
“id”: “inventory_transfers_enable”,
“label”: “t:product_block.inventory_status.settings.inventory_transfers_enable.label”,
“info”: “t:product_block.inventory_status.settings.inventory_transfers_enable.info”,
“default”: true
}
]
},
{
“type”: “sales_point”,
“name”: “t:product_block.sales_point.name”,
“settings”: [
{
“type”: “select”,
“id”: “icon”,
“label”: “t:product_block.sales_point.settings.icon.label”,
“default”: “globe”,
“options”: [
{
“value”: “checkmark”,
“label”: “t:product_block.sales_point.settings.icon.options.checkmark.label”
},
{
“value”: “gift”,
“label”: “t:product_block.sales_point.settings.icon.options.gift.label”
},
{
“value”: “globe”,
“label”: “t:product_block.sales_point.settings.icon.options.globe.label”
},
{
“value”: “heart”,
“label”: “t:product_block.sales_point.settings.icon.options.heart.label”
},
{
“value”: “leaf”,
“label”: “t:product_block.sales_point.settings.icon.options.leaf.label”
},
{
“value”: “lock”,
“label”: “t:product_block.sales_point.settings.icon.options.lock.label”
},
{
“value”: “package”,
“label”: “t:product_block.sales_point.settings.icon.options.package.label”
},
{
“value”: “phone”,
“label”: “t:product_block.sales_point.settings.icon.options.phone.label”
},
{
“value”: “ribbon”,
“label”: “t:product_block.sales_point.settings.icon.options.ribbon.label”
},
{
“value”: “shield”,
“label”: “t:product_block.sales_point.settings.icon.options.shield.label”
},
{
“value”: “tag”,
“label”: “t:product_block.sales_point.settings.icon.options.tag.label”
},
{
“value”: “truck”,
“label”: “t:product_block.sales_point.settings.icon.options.truck.label”
}
]
},
{
“type”: “text”,
“id”: “text”,
“label”: “t:product_block.sales_point.settings.text.label”,
“default”: “Free worldwide shipping”
}
]
},
{
“type”: “text”,
“name”: “t:product_block.text.name”,
“settings”: [
{
“type”: “text”,
“id”: “text”,
“default”: “Text block”,
“label”: “t:product_block.text.settings.text.label”
}
]
},
{
“type”: “trust_badge”,
“name”: “t:product_block.trust_badge.name”,
“settings”: [
{
“type”: “image_picker”,
“id”: “trust_image”,
“label”: “t:product_block.trust_badge.settings.trust_image.label”
}
]
},
{
“type”: “tab”,
“name”: “t:product_block.tab.name”,
“settings”: [
{
“type”: “text”,
“id”: “title”,
“label”: “t:product_block.tab.settings.title.label”,
“default”: “Shipping information”
},
{
“type”: “richtext”,
“id”: “content”,
“label”: “t:product_block.tab.settings.content.label”,
“default”: “

Use collapsible tabs for more detailed information that will help customers make a purchasing decision.

Ex: Shipping and return policies, size guides, and other common questions.


},
{
“type”: “page”,
“id”: “page”,
“label”: “t:product_block.tab.settings.page.label”
}
]
},
{
“type”: “share”,
“name”: “t:product_block.share_on_social.name”,
“limit”: 1,
“settings”: [
{
“type”: “paragraph”,
“content”: “t:product_block.share_on_social.settings.content”
}
]
},
{
“type”: “separator”,
“name”: “t:product_block.separator.name”
},
{
“type”: “contact”,
“name”: “t:product_block.contact_form.name”,
“limit”: 1,
“settings”: [
{
“type”: “paragraph”,
“content”: “t:product_block.contact_form.settings.content”
},
{
“type”: “text”,
“id”: “title”,
“label”: “t:product_block.contact_form.settings.title.label”,
“default”: “Ask a question”
},
{
“type”: “checkbox”,
“id”: “phone”,
“label”: “t:product_block.contact_form.settings.phone.label”
}
]
},
{
“type”: “custom”,
“name”: “t:product_block.html.name”,
“settings”: [
{
“type”: “liquid”,
“id”: “code”,
“label”: “t:product_block.html.settings.code.label”,
“default”: “

Custom code block

Use this advanced section to add custom HTML, app scripts, or liquid.

”,
“info”: “t:product_block.html.settings.code.info”
}
]
}
]
}
{% endschema %}

Could you send the featured-product.liquid file here?

My mailID: deeksha@codezyng.com

Hello DevoloperCZ,

I just sent you the file kindly check.

Thank you :slightly_smiling_face:

can you please share with me this code?

Hey @DevoloperCZ - did you get it working? I am looking for a simple method also for a fabric shop and half meter quantity.

Yes I did it. You can check my store antrikshstore.in