Hello @metagals
You can add some Javascript code that listens to the variant select change and update the SKU in the input accordingly.
Issue: A product inquiry form auto-fills SKU but does not update when a user changes product variants. The SKU was originally inserted via Liquid in an input’s value (can’t be wrapped in a span), and attempting a Liquid snippet inside the input value didn’t work.
Technical context: SKU (stock keeping unit) should reflect the selected product variant (option combination). Because the value is in an input, dynamic updates must be handled with JavaScript rather than Liquid.
Proposed approach: Add JavaScript that listens to the variant selector’s change event, retrieves the selected variant, and updates the input’s value with the correct SKU. This requires: identifying the correct variant select element in the theme and implementing a function to map the selected variant to its SKU (e.g., via variant ID-to-SKU data).
Recent developments: The requester shared their store URLs; a rough code outline with a TODO was posted but not completed. The requester couldn’t get it working and asked for paid help. The helper offered free assistance via email, and the requester has emailed them.
Status: Unresolved on-thread; moving to offline support. Code snippets are central; the screenshot is illustrative only.
Hello @metagals
You can add some Javascript code that listens to the variant select change and update the SKU in the input accordingly.