Skip to content

Commit bdfd02a

Browse files
committed
Add more guards against lack of minicart
1 parent 209b24b commit bdfd02a

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

app/code/Magento/Catalog/view/frontend/web/js/product/provider-compared.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ define([
3535
productCurrentScope,
3636
scopeId;
3737

38-
if (typeof this.data.productCurrentScope !== 'undefined') {
38+
if (typeof this.data.productCurrentScope !== 'undefined' && window.checkout && window.checkout.baseUrl) {
3939
productCurrentScope = this.data.productCurrentScope;
4040
scopeId = productCurrentScope === 'store' ? window.checkout.storeId :
4141
productCurrentScope === 'group' ? window.checkout.storeGroupId :

app/code/Magento/Catalog/view/frontend/web/js/product/provider.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,11 @@ define([
9393
* @private
9494
*/
9595
_resolveDataByIds: function () {
96+
if (!window.checkout || !window.checkout.baseUrl) {
97+
// We need data that the minicart provdes to determine storeId/websiteId
98+
return;
99+
}
100+
96101
this.initIdsListener();
97102
this.idsMerger(
98103
this.idsStorage.get(),

app/code/Magento/Catalog/view/frontend/web/js/product/view/provider.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,13 @@ define([
3030
* @returns {Object} Chainable.
3131
*/
3232
initialize: function () {
33-
this._super()
34-
.initIdsStorage()
35-
.initDataStorage();
33+
this._super();
34+
35+
if (window.checkout && window.checkout.baseUrl) {
36+
this.initIdsStorage();
37+
}
38+
39+
this.initDataStorage();
3640

3741
return this;
3842
},

0 commit comments

Comments
 (0)