Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save CodeBrotha/bc0fe7adc60c4c7ae0155679796c0c1a to your computer and use it in GitHub Desktop.
Save CodeBrotha/bc0fe7adc60c4c7ae0155679796c0c1a to your computer and use it in GitHub Desktop.
discount = 1
message = "Free Standard Shipping"
Input.shipping_rates.each do |shipping_rate|
next unless shipping_rate.source == "shopify"
next unless shipping_rate.name == "Standard Shipping"
shipping_rate.apply_discount(shipping_rate.price * discount, message: message)
end
Output.shipping_rates = Input.shipping_rates
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment