Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save schappim/a38a1d825e51e7baa87c15ce20abada4 to your computer and use it in GitHub Desktop.
Save schappim/a38a1d825e51e7baa87c15ce20abada4 to your computer and use it in GitHub Desktop.
order = ShopifyAPI::Order.last
puts "\nProcessing Order:"
url_to_order = "https://resthouse.myshopify.com/admin/orders/#{order.id}"
url_to_customer = "https://resthouse.myshopify.com/admin/customers/#{order.customer.id}"
puts "<a href=\"#{url_to_order}\" target=\"_blank\">#{url_to_order}</a><br>"
customer = ShopifyAPI::Customer.find order.customer.id
order.line_items.each do |line|
puts line.title
if line.title.downcase.include? 'organic'
customer.tags = "#{customer.tags}, organic"
end
if line.title.downcase.include? 'queen'
customer.tags = "#{customer.tags}, queen"
end
end
puts "\nSaved Tags to:"
puts "<a href=\"#{url_to_customer}\" target=\"_blank\">#{url_to_customer}</a><br>"
customer.save
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment