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(storefront): BCTHEME-264 fix update discount banner on PDP #1974

Merged
merged 2 commits into from
Feb 16, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
@@ -1,6 +1,7 @@
# Changelog

## Draft
- Fixed Discount Banner update on adding item to Cart from PDP [#1974](https://github.com/bigcommerce/cornerstone/pull/1974)
- Updated Cornerstone theme and respected variants to meet the verticals/industries documented in BCTHEME-387
- Fixed selecting certain option types which pushes window view to the bottom of the page. [#1959](https://github.com/bigcommerce/cornerstone/pull/1959)
- Fixed case when default option is out of stock add to cart button does not populate for in stock options. [#1955](https://github.com/bigcommerce/cornerstone/pull/1955)
Expand Down
15 changes: 15 additions & 0 deletions assets/js/theme/common/product-details.js
Original file line number Diff line number Diff line change
Expand Up @@ -401,13 +401,28 @@ export default class ProductDetails extends ProductDetailsBase {
const $cartQuantity = $('[data-cart-quantity]', modal.$content);
const $cartCounter = $('.navUser-action .cart-count');
const quantity = $cartQuantity.data('cartQuantity') || 0;
const $promotionBanner = $('[data-promotion-banner]');
const $backToShopppingBtn = $('.previewCartCheckout > [data-reveal-close]');
const $modalCloseBtn = $('#previewModal > .modal-close');
const bannerUpdateHandler = () => {
const $productContainer = $('#main-content > .container');
yurytut1993 marked this conversation as resolved.
Show resolved Hide resolved

$productContainer.append('<div class="loadingOverlay pdp-update"></div>');
$('.loadingOverlay.pdp-update', $productContainer).show();
window.location.reload();
};

$cartCounter.addClass('cart-count--positive');
$body.trigger('cart-quantity-update', quantity);

if (onComplete) {
onComplete(response);
}

if ($promotionBanner.length && $backToShopppingBtn.length) {
$backToShopppingBtn.on('click', bannerUpdateHandler);
$modalCloseBtn.on('click', bannerUpdateHandler);
}
});
}

Expand Down
2 changes: 1 addition & 1 deletion templates/components/common/alert/alert-info.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="alertBox alertBox--info">
<div class="alertBox alertBox--info" data-promotion-banner>
<div class="alertBox-column alertBox-icon">
<icon glyph="ic-success" class="icon" aria-hidden="true"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"></path></svg></icon>
</div>
Expand Down