fix: Remove auto-order confirmation code

The order confirmation requires MANAGE_ORDERS permission which
the storefront API token doesn't have. Removing the auto-confirmation
attempt to prevent console errors. Orders will remain UNCONFIRMED
until manually confirmed in Saleor Dashboard.
This commit is contained in:
Unchained
2026-03-29 20:49:52 +02:00
parent aa737a1449
commit a516b3a536

View File

@@ -13,7 +13,6 @@ import { saleorClient } from "@/lib/saleor/client";
import { useAnalytics } from "@/lib/analytics"; import { useAnalytics } from "@/lib/analytics";
import { import {
CHECKOUT_SHIPPING_ADDRESS_UPDATE, CHECKOUT_SHIPPING_ADDRESS_UPDATE,
ORDER_CONFIRM,
} from "@/lib/saleor/mutations/Checkout"; } from "@/lib/saleor/mutations/Checkout";
import { PaymentSection } from "./components/PaymentSection"; import { PaymentSection } from "./components/PaymentSection";
import { DEFAULT_PAYMENT_METHOD } from "@/lib/config/paymentMethods"; import { DEFAULT_PAYMENT_METHOD } from "@/lib/config/paymentMethods";
@@ -308,21 +307,6 @@ export default function CheckoutPage() {
setOrderNumber(result.order.number); setOrderNumber(result.order.number);
setOrderComplete(true); setOrderComplete(true);
// Auto-confirm the order
try {
console.log("Auto-confirming order:", result.order.id);
await saleorClient.mutate({
mutation: ORDER_CONFIRM,
variables: {
orderId: result.order.id,
},
});
console.log("Order confirmed successfully");
} catch (confirmError) {
console.error("Failed to auto-confirm order:", confirmError);
// Don't fail the checkout if confirmation fails
}
// Clear the checkout/cart from the store // Clear the checkout/cart from the store
clearCheckout(); clearCheckout();