fix: Remove COD transaction creation to fix checkout errors

The transaction creation was failing due to HANDLE_PAYMENTS permission issues.
Removed the code to get checkout working again. Will implement via
order metadata or core-extensions webhook instead.
This commit is contained in:
Unchained
2026-03-29 19:17:06 +02:00
parent e15e6470d2
commit 9c3d8b0d11

View File

@@ -13,7 +13,6 @@ import { saleorClient } from "@/lib/saleor/client";
import { useAnalytics } from "@/lib/analytics";
import {
CHECKOUT_SHIPPING_ADDRESS_UPDATE,
TRANSACTION_CREATE,
} from "@/lib/saleor/mutations/Checkout";
import { PaymentSection } from "./components/PaymentSection";
import { DEFAULT_PAYMENT_METHOD } from "@/lib/config/paymentMethods";
@@ -307,27 +306,6 @@ export default function CheckoutPage() {
setOrderNumber(result.order.number);
setOrderComplete(true);
// If COD payment, create a transaction on the order
if (selectedPaymentMethod === 'cod' && result.order.id) {
try {
console.log("Creating COD transaction for order:", result.order.id);
await saleorClient.mutate({
mutation: TRANSACTION_CREATE,
variables: {
orderId: result.order.id,
transaction: {
name: "Cash on Delivery",
message: "COD - Payment pending on delivery"
}
}
});
console.log("COD transaction created successfully");
} catch (txError) {
console.error("Failed to create COD transaction:", txError);
// Don't fail the checkout if transaction creation fails
}
}
// Clear the checkout/cart from the store
clearCheckout();