A user is implementing a custom quantity selector for products sold in 100g increments (100g, 200g, etc.).
Implementation approach:
Products are tagged with “quantity-with-grams” (note: code references both this and “sold-by-grams”)
Custom code added to quantity-selector.liquid file
Code includes input field with quantity rules and “00g” suffix appended after the closing tag
Current issue:
The functionality works correctly and displays “00g” at the end, but there’s unwanted spacing between the quantity number and the “g00” text.
User’s question:
Seeking guidance on how to remove the space between the quantity value and the gram indicator.
Note: The code snippet appears partially corrupted/encoded in the original post, which may affect troubleshooting accuracy.
Summarized with AI on November 23.
AI used: claude-sonnet-4-5-20250929.
some of my products count in 100g (100g,200g, …)
first i add tag for that product as”quantity-with-grams”
then i add below code in quantity-selector.liquid
Wrap the input and “00g” in a span or div, then use CSS to remove spacing and padding. Set both elements to inline-block, zero margins, and adjust letter-spacing if needed. This ensures the unit appears flush with the number while keeping the input functional and accessible.
Problematic putting it politely. @AlexRatii you need to be using an intermediary TEXT input for this type of stuff or you gonna have constant headaches from compounding CSS band-aids for every other browser/situation.
Use a text input,
THEN parse the text into a hidden qty input for the product form submission.