Skip to content
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

fix(bctheme): BCTHEME-20 Stencil Themes - Non-required options do not… #1714

Merged
merged 1 commit into from Jul 27, 2020

Conversation

BC-tymurbiedukhin
Copy link
Contributor

… have a 'none' choice on the storefront

What?

Historically, when product options were set to not required a shopper would have the ability to select 'none' on the option. Stencil themes not provide this choice, so if a shopper selects an option that isn't required, they do not have the ability to de-select it by choosing 'none'. This can be frustrating for shoppers, especially when there are price change rules attached to the non-required option.

Tickets / Documentation

https://jira.bigcommerce.com/browse/BCTHEME-20

Screenshots (if appropriate)

Screenshot 2020-07-07 at 13 18 20

ping @yurytut1993 @golcinho @junedkazi

@bigbot
Copy link

bigbot commented Jul 7, 2020

Autotagging @bigcommerce/storefront-team @davidchin

Copy link

@golcinho golcinho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍


try {
for (const [key, val] of formData) {
if (!(val instanceof File) || val.name || val.size) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why loop through the same form data again. Can we just merge this check into the above method definition.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is util function which can be used by its own because I believe sending empty values not only issue for product options fields

* @returns FormData object
*/
export const filterEmptyValuesFromForm = formData => {
const res = new FormData();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason to create a new formData ? since the incoming formData is already of the type FormData

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is pure function which makes result of executing predictable and easy testable. I have faced some issues with changing form data by link so decided to make it in this way

@BC-tymurbiedukhin BC-tymurbiedukhin merged commit 5e469d5 into bigcommerce:master Jul 27, 2020
@BC-tymurbiedukhin BC-tymurbiedukhin deleted the BCTHEME-20 branch July 27, 2020 10:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants