-
-
Notifications
You must be signed in to change notification settings - Fork 313
Fulfillments
Joshua Harms edited this page Dec 20, 2023
·
1 revision
NOTE: Shopify has changed how fulfillments are done in API version 2022-07 and above. This takes affect in ShopifySharp versions 5.19.0 and above. If you're using these versions of ShopifySharp, you should use fulfillment orders to create fulfillments, rather than the
FulfillmentService
.Follow the example code in this issue until our fulfillment documentation is updated.
A fulfillment represents a shipment of one or more items in an order. All fulfillments are tied to a single order.
This will completely fulfill all of the fulfillment orders in the order.
var service = new FulfillmentService(myShopifyUrl, shopAccessToken);
var fulfillmentShipping = new FulfillmentShipping()
{
Message = "Items will be shipped now.",
NotifyCustomer = true,
TrackingInfo = new TrackingInfo()
{
Number = "123456789",
Url = "https://example.com/123456789",
Company = "Jack Black's Pack, Stack and Track"
},
FulfillmentRequestOrderLineItems = []
};
fulfillment = await service.CreateAsync(fulfillmentShipping);
This will fulfill all line items of the specified fulfillment orders.
var service = new FulfillmentService(myShopifyUrl, shopAccessToken);
var fulfillmentShipping = new FulfillmentShipping()
{
Message = "Items will be shipped now.",
NotifyCustomer = true,
TrackingInfo = new TrackingInfo()
{
Number = "123456789",
Url = "https://example.com/123456789",
Company = "Jack Black's Pack, Stack and Track"
},
FulfillmentRequestOrderLineItems = new List<LineItemsByFulfillmentOrder>()
{
new LineItemsByFulfillmentOrder()
{
FulfillmentOrderId = 1,
FulfillmentRequestOrderLineItems = []
}
}
};
fulfillment = await service.CreateAsync(fulfillmentShipping);
var service = new FulfillmentService(myShopifyUrl, shopAccessToken);
var fulfillment = await service.GetAsync(orderId, fulfillmentId);
var service = new FulfillmentService(myShopifyUrl, shopAccessToken);
var fulfillment = await service.UpdateAsync(orderId, fulfillmentId, new Fulfillment()
{
TrackingCompany = "John Doe's Tracking Company"
});
var service = new FulfillmentService(myShopifyUrl, shopAccessToken);
int fulfillmentCount = await service.CountAsync(orderId);
var service = new FulfillmentService(myShopifyUrl, shopAccessToken);
var fulfillments = await service.ListAsync(orderId);
Fulfillments can only be cancelled if their Status
is pending
.
var service = new FulfillmentService(myShopifyUrl, shopAccessToken);
await service.CancelAsync(fulfillmentId)