-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Variant Selector] Toggle automatic variant selection #3467
[Variant Selector] Toggle automatic variant selection #3467
Conversation
TODO: When no variant is selected, the selected options still show the first value as selected
verbiage, setting Alternatives for liquid vars could just be Niceties, sometimes it's convenient if a setting compliments the used variable, example combos:
* variant can be:
|
I like |
…/joshistoast/dawn into feat/disable-auto-variant-select
Will need to revisit this PR with the new option select behavior. |
Implementation will need to be re-thought, since dom updates query using option params instead of variant in the url resulting in |
I'm out of sync with dawn atm but if I get time I'll experiment to see how I'd solve it. |
Looking into implementation now |
PR Summary:
This PR introduces a long-asked for feature in the Dawn theme- the ability to toggle on/off the automatic variant selection behavior.
Also implemented a correction on an unrelated typo I found, more specifically the function
setQuantityBoundries()
, which is nowsetQuantityBoundaries()
.Because some shoppers lack eyeballs, and will add a product to cart without first looking at what options are selected. At my company, this has resulted in customer service complaints from customers ordering the wrong size of clothing by accident.
It's simply a behavior that can be toggled on/off. The old behavior with automatically selected variants remains the default, so no action is needed.
This toggle is directly implemented on the product section, as opposed to being controlled globally. This granularity allows for maximum control over desired behaviors across your product library.
Why are these changes introduced?
Fixes #2254
Most name brand apparel brands don't select a default variant for this reason. It's also worth noting the sheer volume of forums and posts there are asking about this, and outdated tutorials on how to do this to old dawn versions.
What approach did you take?
Most areas of the product page and similar areas refer directly to
selected_or_first_available_variant
. So I instead pointed those elements at a new variable assignment calledselected_variant
.Using the selected variant as a top-level variant improves code quality, and allows us to better control it's behavior.
If
Auto-select first available variant?
is off (default is on), then unless there's more than one variant and a selected variant provided via url or otherwise, it will beempty
by default. Thus prompting shoppers to first make a selection before a variant can be added to the cart.Other considerations
Decision log
Visual impact on existing themes
This will not impact existing themes, the current behavior will remain the default.
Testing steps/scenarios
Demo links
Checklist