Skip to content

Commit

Permalink
Merge pull request scandipwa#5264 from AleksandrsKondratjevs/issue-5257
Browse files Browse the repository at this point in the history
Fix min/max qty for adding product into cart
  • Loading branch information
AleksandrsKondratjevs authored Oct 30, 2022
2 parents 9e8ded3 + 1d5daf2 commit 6e3fcec
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ FieldNumberWitControlsContainerState
this.setState({ value: min });
}

if (defaultValue < min) {
if (defaultValue < min || prevDefaultValue < min) {
this.handleInitialLoad(min);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ export class NotificationComponent extends PureComponent<NotificationComponentPr

CSSHideTimeout: ReturnType<typeof setTimeout> = setTimeout(noopFn);

__construct() {
this.hideNotification = this.hideNotification.bind(this);
}

componentDidMount(): void {
const { notification: { msgType }, lifeTime } = this.props;

Expand Down
2 changes: 1 addition & 1 deletion packages/scandipwa/src/store/Cart/Cart.dispatcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ export class CartDispatcher {
dispatch(showNotification(NotificationType.ERROR, getErrorMessage(error)));
});

return await Promise.reject();
return await Promise.resolve();
}

await this.updateInitialCartData(dispatch);
Expand Down
2 changes: 1 addition & 1 deletion packages/scandipwa/src/util/Validator/Validator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export const validate = (value: string | boolean, rule: ValidationRule): boolean
//#region RANGE
if (range) {
const { min, max, showLengthError } = range;
const isNumber = !!(inputType && inputType in ValidationInputTypeNumber);
const isNumber = !!(inputType && (<any>Object).values(ValidationInputTypeNumber).includes(inputType));

if (isNumber) {
if (min && +value < min) {
Expand Down

0 comments on commit 6e3fcec

Please sign in to comment.