Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Draft
- Fix incorrect request URL for adding items to cart on multi-lang storefronts [#2634](https://github.com/bigcommerce/cornerstone/pull/2634)
- Audit and fix Stencil theme remote API calls for multi-language subfolder support [#2635](https://github.com/bigcommerce/cornerstone/pull/2635)
- Fix desktop header selectors layout for Language, Currency, and Channel [#2633](https://github.com/bigcommerce/cornerstone/pull/2633)
- Fix incorrect request URL for getting states [#2630](https://github.com/bigcommerce/cornerstone/pull/2630)
- Make cart preview work with multi-lang by passing baseUrl to cart API calls [#2627](https://github.com/bigcommerce/cornerstone/pull/2627)
Expand Down
7 changes: 4 additions & 3 deletions assets/js/theme/cart.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ export default class Cart extends PageManager {
this.productDetails = new CartItemDetails(this.$modal, context);

this.bindGiftWrappingForm();
});
}, { baseUrl: this.context.secureBaseUrl });

utils.hooks.on('product-option-change', (event, currentTarget) => {
const $form = $(currentTarget).find('form');
Expand Down Expand Up @@ -196,7 +196,7 @@ export default class Cart extends PageManager {
} else {
$submit.prop('disabled', false);
}
});
}, { baseUrl: this.context.secureBaseUrl });
});
}

Expand Down Expand Up @@ -405,6 +405,7 @@ export default class Cart extends PageManager {
const itemId = $(event.currentTarget).data('itemGiftwrap');
const options = {
template: 'cart/modals/gift-wrapping-form',
baseUrl: this.context.secureBaseUrl,
};

event.preventDefault();
Expand Down Expand Up @@ -478,7 +479,7 @@ export default class Cart extends PageManager {
country: this.context.shippingCountryErrorMessage,
province: this.context.shippingProvinceErrorMessage,
};
this.shippingEstimator = new ShippingEstimator($('[data-shipping-estimator]'), shippingErrorMessages);
this.shippingEstimator = new ShippingEstimator($('[data-shipping-estimator]'), shippingErrorMessages, this.context.secureBaseUrl);
}

bindDiscountToggle() {
Expand Down
7 changes: 5 additions & 2 deletions assets/js/theme/cart/shipping-estimator.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ import collapsibleFactory from '../common/collapsible';
import { showAlertModal } from '../global/modal';

export default class ShippingEstimator {
constructor($element, shippingErrorMessages) {
constructor($element, shippingErrorMessages, secureBaseUrl) {
this.$element = $element;

this.$state = $('[data-field-type="State"]', this.$element);
this.isEstimatorFormOpened = false;
this.shippingErrorMessages = shippingErrorMessages;
this.secureBaseUrl = secureBaseUrl;
this.initFormValidation();
this.bindStateCountryChange();
this.bindEstimatorEvents();
Expand Down Expand Up @@ -176,6 +177,8 @@ export default class ShippingEstimator {

event.preventDefault();

const requestOptions = this.secureBaseUrl ? { baseUrl: this.secureBaseUrl } : {};

utils.api.cart.getShippingQuotes(params, 'cart/shipping-quotes', (err, response) => {
$('.shipping-quotes').html(response.content);

Expand All @@ -189,7 +192,7 @@ export default class ShippingEstimator {
window.location.reload();
});
});
});
}, requestOptions);
});

$('.shipping-estimate-show').on('click', event => {
Expand Down
2 changes: 1 addition & 1 deletion assets/js/theme/common/cart-item-details.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export default class CartItemDetails extends ProductDetailsBase {
if ((isEmpty(productAttributesData) || hasDefaultOptions) && hasOptions) {
const productId = this.context.productForChangeId;

utils.api.productAttributes.optionChange(productId, $form.serialize(), 'products/bulk-discount-rates', optionChangeCallback);
utils.api.productAttributes.optionChange(productId, $form.serialize(), 'products/bulk-discount-rates', optionChangeCallback, { baseUrl: this.context.secureBaseUrl });
} else {
this.updateProductAttributes(productAttributesData);
}
Expand Down
2 changes: 1 addition & 1 deletion assets/js/theme/common/product-details.js
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ export default class ProductDetails extends ProductDetailsBase {
data: productAttributesContent,
},
}));
});
}, { baseUrl: this.context.secureBaseUrl });
}

/**
Expand Down
Loading