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 @@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Update `hasProductErrors` in Product component and support additional sku in custom options - @gibkigonzo (#3976)
- Fixed Stock logic not working with manage_stock set to false - @andrzejewsky - (#3957)
- Support old price format in `ProductPrice` - @gibkigonzo (#3978)
- Fixed product bundle comparison condition - @gk-daniel (#4004)

## [1.11.0] - 2019.12.20

Expand Down
4 changes: 3 additions & 1 deletion core/modules/cart/helpers/productsEquals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ const productsEquals = (product1: CartItem, product2: CartItem): boolean => {
const typeProduct2 = getProductType(product2)

if (typeProduct1 === 'bundle' || typeProduct2 === 'bundle') {
return isServerIdsEquals(product1, product2) || isChecksumEquals(product1, product2)
if (isServerIdsEquals(product1, product2) || isChecksumEquals(product1, product2)) {
return true
}
}

return isServerIdsEquals(product1, product2) || String(product1.sku) === String(product2.sku)
Expand Down
8 changes: 4 additions & 4 deletions core/modules/cart/test/unit/helpers/productEquals.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,12 @@ describe('Cart productEquals', () => {

expect(productsEquals(product1, product2)).toBeTruthy()
});

it('returns false because bundle products have not the same options selected', async () => {
it('returns true because bundle products have not the same options selected', async () => {
const product1 = createBundleProduct({ id: 1, sku: 'WG-001', type_id: 'bundle', options: [2, 2, 5, 8] })
const product2 = createBundleProduct({ id: 2, sku: 'WG-001', type_id: 'bundle', options: [2, 4, 5, 8] })

expect(productsEquals(product1, product2)).toBeFalsy()
expect(productsEquals(product1, product2)).toBeTruthy()
});

it('returns true because bundle products have the same server id', async () => {
Expand All @@ -79,7 +79,7 @@ describe('Cart productEquals', () => {
expect(productsEquals(product1, product2)).toBeTruthy()
});

it('returns true because configurable products have the same eku', async () => {
it('returns true because configurable products have the same sku', async () => {
const product1 = createConfigurableProduct({ id: 1, sku: 'WG-001' })
const product2 = createConfigurableProduct({ id: 2, sku: 'WG-001' })

Expand Down