2024-12-29 15:02:58 +01:00

12 lines
432 B
TypeScript

import { woocommerce } from "lib/woocomerce/woocommerce";
import { NextRequest, NextResponse } from "next/server";
export async function POST(req: NextRequest) {
try {
const data = await req.json();
const cart = await woocommerce.post('customers', data);
return NextResponse.json(cart, { status: 200 });
} catch (error) {
return NextResponse.json({ error: 'Failed to add item to cart' }, { status: 500 });
}
}