Skip to content

Commit

Permalink
fix: quote tax price fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
kris-liu-smile authored and CarlLiu2023 committed May 10, 2023
1 parent 088e4ad commit 1694dde
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,16 @@ export default function ProductListDialog(props: ProductListDialogProps) {
const product = productList.find((product) => product.id === id)

if (product && validateQuantityNumber(product || {})) {
let variantId: number | string = product?.variantId || 0
if (!product?.variantId && product?.variants?.length) {
variantId = product.variants[0].variant_id
}
onAddToListClick([
{
...product,
newSelectOptionList: [],
quantity: parseInt(product.quantity.toString(), 10) || 1,
variantId: id,
variantId,
},
])
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ export default function SearchProduct({
const handleAddToListClick = async (products: CustomFieldItems[]) => {
try {
setIsLoading(true)
await calculateProductListPrice(products)
await addToList(products)

updateList()
Expand All @@ -108,8 +109,8 @@ export default function SearchProduct({
}
}

const handleProductListAddToList = (products: CustomFieldItems[]) => {
handleAddToListClick(products)
const handleProductListAddToList = async (products: CustomFieldItems[]) => {
await handleAddToListClick(products)
}

const handleChangeOptionsClick = (productId: number) => {
Expand All @@ -128,7 +129,9 @@ export default function SearchProduct({
setProductListOpen(true)
}

const handleChooseOptionsDialogConfirm = async (products: CustomFieldItems[]) => {
const handleChooseOptionsDialogConfirm = async (
products: CustomFieldItems[]
) => {
try {
setIsLoading(true)
await calculateProductListPrice(products)
Expand All @@ -139,7 +142,6 @@ export default function SearchProduct({
} catch (error) {
setIsLoading(false)
}

}

return (
Expand Down
1 change: 1 addition & 0 deletions apps/storefront/src/types/shoppingList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ export interface ShoppingListProductItem extends ProductItem {
selectOptions?: string
orderQuantityMaximum?: number
orderQuantityMinimum?: number
variantId?: number | string
}

export interface ShoppingListAddProductOption {
Expand Down

0 comments on commit 1694dde

Please sign in to comment.