Open BasitBulbulia opened 10 months ago
Hey @BasitBulbulia! I think the problem is the LocationService.ListAsync
does not return a list directly, instead it returns this ListResult<Location>
object, so you can't do locations(0).Id
.
You should be able to fix that error by using locations.Items(0).Id
.
I tried that this is the errors in IDE
Oh I see, which version were you using before @BasitBulbulia? It looks like you're using the older method for creating fulfillments that Shopify has deprecated and removed. They require apps to use a new "Fulfillment Order" based approach for fulfilling line items and entire orders, we're not allowed to create fulfillments with the old API anymore.
I don't know much VB unfortunately, so this may not be entirely correct. I think you want something like this:
Try
Dim fulfillmentOrderService As New FulfillmentOrderService(domain, accessToken)
Dim fulfillmentService As New FulfillmentService(domain, accessToken)
Dim policy As New LeakyBucketExecutionPolicy()
fulfillmentOrderService.SetExecutionPolicy(policy)
fulfillmentService.SetExecutionPolicy(policy)
' Find open fulfillment orders for this order
Dim openFulfillmentOrders = Await fulfillmentOrderService.ListAsync(orderId)
openFulfillmentOrders = openFulfillmentOrders.Where(Function(f) f.Status = "open").ToList()
' Fulfill all line items across all open fulfillment orders in this Shopify order
Dim lineItems = openFulfillmentOrders.Select(Function(o) New LineItemsByFulfillmentOrder With {
.FulfillmentOrderId = o.Id.Value
' Optionally specify a list of line items if you're doing a partial fulfillment
' .FulfillmentRequestOrderLineItems = ...
})
' Fulfill the line items
Dim fulfillment = Await fulfillmentService.CreateAsync(New FulfillmentShipping With {
.Message = "items are shipping!",
' Set to true to send an email to the customer that their items have shipped
.NotifyCustomer = False,
' You can leave the tracking info out if you have no tracking info
.TrackingInfo = New TrackingInfo With {
.Company = "UPS",
.Url = "...",
.Number = "..."
}
})
Catch ex As Exception
If DoAllStockUpdate = False Then MsgBox("SetOrdersAsComplete-->" & ex.Message)
Return False
End Try
Check this thread here for more info on the Fulfillment Orders workflow: #828
This is my code !
The error is :- ListResult(Of Location)' cannot be indexed because it has no default property.
The error location is @ locations(0).Id
I am totally lost as to how I could fix this code