Shopify_api Ruby Gem not creating fulfillment

298 views Asked by At

I have a csv that we upload to an app and I want that csv with Order Number and Tracking Number to then go in and mark the order as fulfilled and put in a tracking number on each order. When coding this, my Intellisense is not picking up the ShopifyAPI::Fulfillment so I am not 100% sure if that is how I should do it. I don't get an error in the code but I also don't get the order fulfilled... am I doing something wrong?

order = ShopifyAPI::Order.find(:all, params: { name: o_id, status: "any" }) 
if order[0].id != "" and !order[0].id.to_s.empty? 
  items = Array.new order[0].line_items.each do |item| 
    items.push({"id": item.id}) 
  end 
  fulfill = ShopifyAPI::Fulfillment.new(order_id: order[0].id, line_items: items) 
  fulfill.tracking_numbers = [track.to_s] 
  puts fulfill 
  fulfill.save 
  order[0].save 
end
1

There are 1 answers

0
David Lazar On BEST ANSWER

Fulfillments are now requiring you to specify a location where the item is being fulfilled from. Check out the documentation concerning Locations and Inventory Items.

Once you have a location ID, you can create a fulfillment for an item from an order.