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

Update product UPC when options are selected #1089

Merged
merged 1 commit into from
Sep 27, 2017
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 @@ -2,6 +2,7 @@

## Draft
- Style optimized checkout new checklist radio buttons [#1088](https://github.com/bigcommerce/cornerstone/pull/1088)
- Update product UPC when options with different UPC are selected [#1089](https://github.com/bigcommerce/cornerstone/pull/1089)

## 1.9.3 (2017-09-19)
- Fixes image overlapping details on product page and Quick View on small viewports [#1067](https://github.com/bigcommerce/cornerstone/pull/1067)
Expand Down
6 changes: 6 additions & 0 deletions assets/js/theme/common/product-details.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ export default class ProductDetails {
$input: $('[data-product-stock]', $scope),
},
$sku: $('[data-product-sku]'),
$upc: $('[data-product-upc]'),
Copy link
Contributor Author

@junedkazi junedkazi Sep 27, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The data tag already exists

<dd class="productView-info-value" data-product-upc>{{product.upc}}</dd>

quantity: {
$text: $('.incrementTotal', $scope),
$input: $('[name=qty\\[\\]]', $scope),
Expand Down Expand Up @@ -370,6 +371,11 @@ export default class ProductDetails {
viewModel.$sku.text(data.sku);
}

// If UPC is available
if (data.upc) {
viewModel.$upc.text(data.upc);
}

// if stock view is on (CP settings)
if (viewModel.stock.$container.length && _.isNumber(data.stock)) {
// if the stock container is hidden, show
Expand Down