Skip to content
Open
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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

- Add `tax` attribute to `Item` type
- Add `tax` attribute to `DeliveryOption` type and compute it by summing up all shipment taxes

## [0.67.0] - 2024-02-27

### Added
Expand Down
1 change: 1 addition & 0 deletions graphql/types/Item.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ type Item {
sellingPriceWithAssemblies: Float
skuName: String @translatableV2
skuSpecifications: [SKUSpecification!]!
tax: Float
uniqueId: String!
unitMultiplier: Float
priceTags: [PriceTag!]!
Expand Down
1 change: 1 addition & 0 deletions graphql/types/Shipping.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ type DeliveryOption {
id: String!
deliveryChannel: String!
price: Int!
tax: Int
estimate: String!
isSelected: Boolean!
}
Expand Down
3 changes: 3 additions & 0 deletions node/utils/delivery-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export function getFormattedDeliveryOptions(
) {
return deliveryOptions.map(sla => {
let price = 0
let tax = 0

const isSelected =
logisticsInfo?.some(li => li.selectedSla === sla.id) ?? false
Expand All @@ -15,6 +16,7 @@ export function getFormattedDeliveryOptions(

if (currentSla) {
price += currentSla.price
tax += currentSla.tax
}
})

Expand All @@ -23,6 +25,7 @@ export function getFormattedDeliveryOptions(
id: sla.id,
isSelected,
price,
tax,
deliveryChannel: sla.deliveryChannel,
sla,
...(sla.deliveryChannel === PICKUP_IN_POINT
Expand Down