Skip to content

Commit b3b89a3

Browse files
author
Michail Slabko
committed
MAGETWO-39475: [GITHUB] No error message shown when purchase qty mismatch the 'Qty Increments' setup #1411
1 parent e9b1713 commit b3b89a3

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

app/code/Magento/Catalog/view/frontend/web/js/catalog-add-to-cart.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ define([
7474
$('body').trigger(self.options.processStop);
7575
}
7676

77-
if (res.backUrl) {
78-
window.location = res.backUrl;
77+
if (res.redirect) {
78+
window.location = res.redirect;
7979
return;
8080
}
8181
if (res.messages) {

app/code/Magento/Checkout/Controller/Cart/Add.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ protected function goBack($backUrl = null, $product = null)
169169
$result = [];
170170

171171
if ($backUrl || $backUrl = $this->getBackUrl()) {
172-
$result['backUrl'] = $backUrl;
172+
$result['redirect'] = $backUrl;
173173
} else {
174174
if ($product && !$product->getIsSalable()) {
175175
$result['product'] = [

app/code/Magento/Customer/view/frontend/web/js/customer-data.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ define([
4545
getFromServer: function (sectionNames) {
4646
var parameters = _.isArray(sectionNames) ? {sections: sectionNames.join(',')} : [];
4747
return $.getJSON(options.sectionLoadUrl, parameters).fail(function(jqXHR) {
48-
throw new Error(jqXHR.responseJSON.message);
48+
throw new Error(jqXHR);
4949
});
5050
}
5151
};
@@ -134,6 +134,10 @@ define([
134134
var sections = sectionConfig.getAffectedSections(settings.url);
135135
if (sections) {
136136
customerData.invalidate(sections);
137+
var redirects = ['redirect'];
138+
if (_.isObject(xhr.responseJSON) && !_.isEmpty(_.pick(xhr.responseJSON, redirects))) {
139+
return ;
140+
}
137141
customerData.reload(sections);
138142
}
139143
}

0 commit comments

Comments
 (0)