Skip to content

Commit

Permalink
fix: cart cant checkout one item
Browse files Browse the repository at this point in the history
  • Loading branch information
ainunns committed Dec 1, 2024
1 parent 82e4033 commit bcbe987
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion resources/js/Pages/Cart/Index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,13 @@ const CartIndex = ({ cart }: { cart: CartType[] }) => {
const readyToCheckout =
cart.filter((item) => checkedOut.includes(item.id.toString())) ?? [];

transform((data) => ({ ...data, ...getValues() }));
transform((data) => ({
...data,
product_id:
typeof getValues("product_id") === "string"
? [getValues("product_id")]
: getValues("product_id"),
}));

const onSubmit: SubmitHandler<CheckoutProductType> = async () => {
post(route("cart.checkout"), {
Expand Down

0 comments on commit bcbe987

Please sign in to comment.