This commit is contained in:
gpt-engineer-app[bot]
2026-01-28 13:11:06 +00:00
parent 5a55c23b0a
commit 2ab7e578ab
3 changed files with 73 additions and 5 deletions
+4 -1
View File
@@ -53,7 +53,7 @@ const PlansSection = () => {
const [checkoutLoading, setCheckoutLoading] = useState(false);
const { products, isLoading: productsLoading } = useShopifyProducts("product_type:Abonnemang");
const { addItem, getCheckoutUrl, isLoading: cartLoading } = useCartStore();
const { addItem, getCheckoutUrl, clearCart, isLoading: cartLoading } = useCartStore();
const handleSelectPlan = async (plan: typeof planDetails[0]) => {
// Find the matching Shopify product
@@ -74,6 +74,9 @@ const PlansSection = () => {
setSelectedPlan(plan.name);
try {
// Clear any existing cart items first for a clean checkout
clearCart();
await addItem({
product: shopifyProduct,
variantId: variant.id,