diff --git a/customer-spa/src/pages/Checkout/index.tsx b/customer-spa/src/pages/Checkout/index.tsx index 7974819..5502d9c 100644 --- a/customer-spa/src/pages/Checkout/index.tsx +++ b/customer-spa/src/pages/Checkout/index.tsx @@ -304,11 +304,11 @@ export default function Checkout() { toast.success('Order placed successfully!'); - // Use full page reload instead of SPA routing - // This ensures auto-registered users get their auth cookies properly set - const thankYouUrl = `${window.location.origin}/store/#/order-received/${data.order_id}?key=${data.order_key}`; - window.location.href = thankYouUrl; - window.location.reload(); + // Navigate to thank you page via SPA routing + // Using window.location.replace to prevent back button issues + const thankYouUrl = `/order-received/${data.order_id}?key=${data.order_key}`; + navigate(thankYouUrl, { replace: true }); + return; // Stop execution here } else { throw new Error(data.error || 'Failed to create order'); } @@ -320,8 +320,8 @@ export default function Checkout() { } }; - // Empty cart redirect - if (cart.items.length === 0) { + // Empty cart redirect (but only if not processing) + if (cart.items.length === 0 && !isProcessing) { return (
@@ -771,7 +771,7 @@ export default function Checkout() {
{/* Shipping Options */} - {elements.shipping_options && ( + {!isVirtualOnly && elements.shipping_options && (

Shipping Method

@@ -806,10 +806,12 @@ export default function Checkout() { -{formatPrice(discountTotal)}
)} -
- Shipping - {shipping === 0 ? 'Free' : formatPrice(shipping)} -
+ {!isVirtualOnly && ( +
+ Shipping + {shipping === 0 ? 'Free' : formatPrice(shipping)} +
+ )} {tax > 0 && (
Tax diff --git a/includes/Api/ProductsController.php b/includes/Api/ProductsController.php index c83b328..1d45c21 100644 --- a/includes/Api/ProductsController.php +++ b/includes/Api/ProductsController.php @@ -621,6 +621,7 @@ class ProductsController { $categories = []; foreach ($terms as $term) { $categories[] = [ + 'id' => $term->term_id, 'term_id' => $term->term_id, 'name' => $term->name, 'slug' => $term->slug, @@ -649,6 +650,7 @@ class ProductsController { $tags = []; foreach ($terms as $term) { $tags[] = [ + 'id' => $term->term_id, 'term_id' => $term->term_id, 'name' => $term->name, 'slug' => $term->slug,