Created
December 16, 2011 20:35
-
-
Save resistorsoftware/1487854 to your computer and use it in GitHub Desktop.
Update Fulfillment with Order ID
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
f = ShopifyAPI::Fulfillment.find(:first, :params => {:order_id => order_id}) | |
if f.nil? | |
fulfillment = ShopifyAPI::Fulfillment.new({:order_id => order_id, :notify_customer => true, :tracking_number => "123456"}) | |
fulfillment.save | |
else | |
f.tracking_number = '123456' | |
f.notify_customer = true | |
f.save | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you, this gist was exactly what I was looking for.
I am however having an issue tweaking this to fulfill a single line item. When I pass a line items parameter hash like is suggested in the shopify api (http://api.shopify.com/fulfillment.html#create) (e.g. :line_items => { "id" => v } ) the api returns a 500 error. Are you familiar with the correct syntax?
Thanks,
Stewart Knapman.