Skip to content

Commit

Permalink
fix: get price by customer group id
Browse files Browse the repository at this point in the history
  • Loading branch information
CarlLiu2023 committed Jun 6, 2023
1 parent b5a4803 commit 655fa3a
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions apps/storefront/src/utils/b3Product/b3Product.ts
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,15 @@ interface CalculatedProductPrice {
qty: number
}

const getCustomerGroupId = () => {
let customerGroupId = 0
const B3CustomerInfo = B3SStorage.get('B3CustomerInfo')
if (B3CustomerInfo && Object.keys(B3CustomerInfo).length !== 0) {
customerGroupId = B3CustomerInfo.customerGroupId
}
return customerGroupId
}

const getCalculatedProductPrice = async (
{ optionList, productsSearch, sku, qty }: CalculatedProductPrice,
calculatedValue?: CustomFieldItems
Expand All @@ -608,12 +617,13 @@ const getCalculatedProductPrice = async (
productsSearch?.allOptions || []
)
const channelId = B3SStorage.get('B3channelId')
const customerGroupId = getCustomerGroupId()

const data = {
channel_id: channelId,
currency_code: getDefaultCurrencyInfo().currency_code,
items,
customer_group_id: 0,
customer_group_id: customerGroupId,
}

let calculatedData = []
Expand Down Expand Up @@ -719,11 +729,13 @@ const calculateProductListPrice = async (

const channelId = B3SStorage.get('B3channelId')

const customerGroupId = getCustomerGroupId()

const data = {
channel_id: channelId,
currency_code: getDefaultCurrencyInfo().currency_code,
items: itemsOptions,
customer_group_id: 0,
customer_group_id: customerGroupId,
}

const res = await getProxyInfo({
Expand Down

0 comments on commit 655fa3a

Please sign in to comment.