(888) 475-FLOW(3569)

Landed Cost Ruby

Landed Cost Ruby
# Products in Flow are localized (duty, tax, and currency calculated) by 
# experience; usually by country. The ruby code below will find the 
# best experience and localized items for Canada, in this example.

require 'flowcommerce'

ORG = 'playground'
client = FlowCommerce.instance(:token => 'HlGgfflLamiTQJ')

client.experiences.get_items(ORG, :country => 'CAN', :number => ['sku-1', 'sku-2']).each do |i|
 puts i.number
 i.local.prices.each do |price|
 case price.key
 when "localized_item_price"
 puts " - Price: #{price.label}"
 when "localized_item_vat"
 puts " - #{price.name}: #{price.label}"
 when "localized_item_duty"
 puts " - Duty: #{price.label}"