feat(MED-100): partner location metadata stored on order line instead of order

This commit is contained in:
2025-07-24 09:23:44 +03:00
parent 3341dbd306
commit 894cf1b454
6 changed files with 31 additions and 18 deletions

View File

@@ -14,6 +14,7 @@ import {
} from "./cookies";
import { getRegion } from "./regions";
import { sdk } from "@lib/config";
import { retrieveOrder } from "./orders";
/**
* Retrieves a cart by its ID. If no ID is provided, it will use the cart ID from the cookies.
@@ -161,9 +162,11 @@ export async function addToCart({
export async function updateLineItem({
lineId,
quantity,
metadata,
}: {
lineId: string;
quantity: number;
metadata?: Record<string, any>;
}) {
if (!lineId) {
throw new Error("Missing lineItem ID when updating line item");
@@ -180,7 +183,7 @@ export async function updateLineItem({
};
await sdk.store.cart
.updateLineItem(cartId, lineId, { quantity }, {}, headers)
.updateLineItem(cartId, lineId, { quantity, metadata }, {}, headers)
.then(async () => {
const cartCacheTag = await getCacheTag("carts");
revalidateTag(cartCacheTag);
@@ -425,7 +428,7 @@ export async function placeOrder(cartId?: string, options: { revalidateCacheTags
throw new Error("Cart is not an order");
}
return cartRes;
return retrieveOrder(cartRes.order.id);
}
/**