Hi @Deeprintz
I asked the Shopify Dev MCP your questions and this is the advice generated:
To implement a customized delivery partner flow in Shopify, you have several options depending on how deep you want to integrate and customize the fulfillment and delivery experience. Here’s a breakdown of the best approaches, relevant APIs/extension points, and compliance considerations:
1. Extension Points & APIs for Custom Delivery Flows
a. Carrier Services (for Custom Shipping Rates)
If your delivery partner needs to provide custom shipping rates at checkout, you can use the CarrierService API. This allows you to register a callback URL that Shopify will call during checkout to fetch rates.
- Create, update, or delete carrier services using the following mutations:
Example mutation to update a carrier service:
mutation {
carrierServiceUpdate(input: {
id: "gid://shopify/DeliveryCarrierService/123456789",
name: "Custom Delivery Partner",
callbackUrl: "https://your-callback-url.com/",
active: true
}) {
carrierService {
id
name
callbackUrl
active
}
userErrors {
field
message
}
}
}
This lets you inject your own delivery logic for rate calculation at checkout.
b. Fulfillment Services (for Custom Fulfillment Logic)
If your delivery partner is responsible for fulfilling orders (not just providing rates), you can register a FulfillmentService. This allows you to manage fulfillment requests, tracking, and status updates.
c. Delivery Customizations (Shopify Functions)
For advanced delivery logic (e.g., conditional delivery options, custom delivery methods), you can use Delivery Customizations via Shopify Functions. This lets you programmatically alter delivery options shown at checkout.
- Use the
deliveryCustomizationCreate mutation to register a delivery customization function.
- You can also use metafields to store custom data related to delivery customizations.
d. Fulfillment Constraint Rules
If you need to restrict or customize fulfillment based on delivery method types (e.g., only allow your partner for certain products or zones), you can use FulfillmentConstraintRule and related mutations.
2. Best Practices & Compliance
- Use Official APIs: Always use the documented Admin GraphQL API endpoints and mutations for creating or updating carrier/fulfillment services.
- Data Storage: Store any custom delivery data in metafields attached to orders, fulfillments, or customers as needed.
- Checkout Extensibility: For checkout customizations, use Shopify Functions or Checkout UI Extensions where possible to remain compliant and future-proof.
- App Policies: If you are building an app (even private/custom), ensure you follow Shopify’s API and app store policies regarding data privacy, permissions, and user experience.
3. Recommendations
- For rate calculation only: Use Carrier Services.
- For full fulfillment management: Use Fulfillment Services.
- For checkout delivery option customization: Use Delivery Customizations via Shopify Functions.
- For storing custom delivery data: Use Metafields on relevant resources.
4. Example: Querying Delivery Methods for an Order
To fetch delivery methods and their types for an order’s fulfillment, you can use:
query {
order(id: "gid://shopify/Order/123456789") {
fulfillments(first: 5) {
edges {
node {
deliveryMethod {
id
methodType # e.g., SHIPPING, LOCAL, PICK_UP
maxDeliveryDateTime
minDeliveryDateTime
}
}
}
}
}
}
This helps you understand what delivery method was chosen and can be extended for custom logic.
Summary:
You can implement a custom delivery partner flow using Carrier Services, Fulfillment Services, Delivery Customizations (Shopify Functions), and Metafields. Choose the approach that matches your business logic and integration depth. Always use official APIs and follow Shopify’s compliance guidelines for data and checkout modifications.
If you have a specific workflow or technical requirement, let me know and I can provide more targeted GraphQL queries or mutation examples!
Related resources
To learn more about the resources in the generated operation, refer to these related reference pages:
carrierServiceUpdate