Skip to content

Commit

Permalink
feat(storefront): BCTHEME-306 show price range on option selection
Browse files Browse the repository at this point in the history
  • Loading branch information
bc-alexsaiannyi committed Jan 5, 2021
1 parent babdd27 commit fd47019
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Changelog

## Draft
- Added narrow down pricing during option selections [#1924](https://github.com/bigcommerce/cornerstone/pull/1924)

## 5.0.0 (12-14-2020)
- Parse HTML entities in jsContext. [#1917](https://github.com/bigcommerce/cornerstone/pull/1917)
Expand Down
2 changes: 1 addition & 1 deletion assets/js/test-unit/theme/common/payment-method.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ describe('PaymentMethod', () => {

it('should have valid input expiration date', () => {
const callback = jasmine.createSpy();
const validator = { add: ({ validate }) => validate(callback, '12/20') };
const validator = { add: ({ validate }) => validate(callback, '12/25') };
Validators.setExpirationValidation(validator, 'selector');

expect(callback).toHaveBeenCalledWith(true);
Expand Down
10 changes: 8 additions & 2 deletions assets/js/theme/common/product-details-base.js
Original file line number Diff line number Diff line change
Expand Up @@ -274,13 +274,19 @@ export default class ProductDetailsBase {
this.clearPricingNotFound(viewModel);

if (price.with_tax) {
const updatedPrice = price.price_range ?
`${price.price_range.min.with_tax.formatted} - ${price.price_range.max.with_tax.formatted}`
: price.with_tax.formatted;
viewModel.priceLabel.$span.show();
viewModel.$priceWithTax.html(price.with_tax.formatted);
viewModel.$priceWithTax.html(updatedPrice);
}

if (price.without_tax) {
const updatedPrice = price.price_range ?
`${price.price_range.min.without_tax.formatted} - ${price.price_range.max.without_tax.formatted}`
: price.without_tax.formatted;
viewModel.priceLabel.$span.show();
viewModel.$priceWithoutTax.html(price.without_tax.formatted);
viewModel.$priceWithoutTax.html(updatedPrice);
}

if (price.rrp_with_tax) {
Expand Down

0 comments on commit fd47019

Please sign in to comment.