Co-authored-by: wolfoftyreso-debug <250630591+wolfoftyreso-debug@users.noreply.github.com>
This commit is contained in:
gpt-engineer-app[bot]
2026-07-11 11:34:23 +00:00
parent 3596350425
commit b8b7914eae
+17 -1
View File
@@ -54,11 +54,27 @@ const PlansSection = () => {
return; return;
} }
const sellingPlanId =
shopifyProduct.node.sellingPlanGroups?.edges?.[0]?.node?.sellingPlans?.edges?.[0]?.node?.id;
if (!sellingPlanId) {
toast.error(
"Ingen abonnemangsplan hittades i Shopify. Kontrollera att Appstle-planen är kopplad till produkten."
);
return;
}
setLoadingMethod(method); setLoadingMethod(method);
try { try {
const data = await storefrontApiRequest(CART_CREATE_MUTATION, { const data = await storefrontApiRequest(CART_CREATE_MUTATION, {
input: { input: {
lines: [{ quantity: 1, merchandiseId: variant.id }], lines: [
{
quantity: 1,
merchandiseId: variant.id,
sellingPlanId,
},
],
attributes: [ attributes: [
{ key: "Antal anställda", value: String(employees) }, { key: "Antal anställda", value: String(employees) },
{ key: "Rekommenderad mängd", value: `${recommendedKg} kg/vecka` }, { key: "Rekommenderad mängd", value: `${recommendedKg} kg/vecka` },