I have developed a shopify shipping discount function to apply discount at checkout. For now, I have written logic to fetch shipping cost of deliveryGroups[0].deliveryOptions[0].cost
. What if user has multiple shipping methods(delivery options). My logic will fail in that case. so I need to fetch the selected deliveryOption details so that I can pass the correct shipping cost and then return the discount value to be applied correctly. Could someone help me with this, like how can I get the detail of deliveryOption which is chosen by user.
Please use the selectedDeliveryOption field inside the deliveryGroups.
query RunInput {
cart {
cost {
subtotalAmount {
amount
}
}
lines {
quantity
merchandise {
... on ProductVariant {
id
title
product {
id
title
handle
}
}
}
}
deliveryGroups {
id
deliveryOptions {
handle
title
cost {
amount
}
}
selectedDeliveryOption {
handle
title
cost {
amount
}
}
}
}
}
is this how it should be formatted to query the selectedDeliveryOption right??
Also I want to know how I can fetch app embed status of my application from the merchant who installs my application. I read through document, but not able to find anything positive…
Yes, the query is correct. Please check the partner account and then open your App. The App status can see in the overview section.
1 Like
Thanks for taking time respond. The query works fine and I’m able to fetch the selected delivery option.