summaryrefslogtreecommitdiff
path: root/src/lib/checkout/components/Checkout.jsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/checkout/components/Checkout.jsx')
-rw-r--r--src/lib/checkout/components/Checkout.jsx16
1 files changed, 2 insertions, 14 deletions
diff --git a/src/lib/checkout/components/Checkout.jsx b/src/lib/checkout/components/Checkout.jsx
index ffb33eb7..ac751ff4 100644
--- a/src/lib/checkout/components/Checkout.jsx
+++ b/src/lib/checkout/components/Checkout.jsx
@@ -19,7 +19,6 @@ import axios from 'axios'
import Image from '@/core/components/elements/Image/Image'
import MobileView from '@/core/components/views/MobileView'
import DesktopView from '@/core/components/views/DesktopView'
-import variantPriceApi from '@/lib/variant/api/variantPriceApi'
const Checkout = () => {
const router = useRouter()
@@ -59,7 +58,6 @@ const Checkout = () => {
})
}, [addresses])
- const [paymentMethod, setPaymentMethod] = useState('')
const [products, setProducts] = useState(null)
const [totalAmount, setTotalAmount] = useState(0)
const [totalDiscountAmount, setTotalDiscountAmount] = useState(0)
@@ -78,25 +76,15 @@ const Checkout = () => {
}
const dataProducts = await CartApi({ variantIds })
- const productsWithQuantity = dataProducts?.map(async (product) => {
- const productPrice = await variantPriceApi({ id: product.id })
+ const productsWithQuantity = dataProducts?.map((product) => {
return {
...product,
- price: {
- price: productPrice.priceExclude,
- discountPercentage: productPrice.discount,
- priceDiscount: productPrice.priceExcludeAfterDiscount
- },
quantity: query.quantity
? query.quantity
: getItemCart({ productId: product.id }).quantity
}
})
- if (productsWithQuantity) {
- Promise.all(productsWithQuantity).then((resolvedProducts) => {
- setProducts(resolvedProducts)
- })
- }
+ setProducts(productsWithQuantity)
}
loadProducts()
}, [router])