What is the code you have at the moment that isn't working?
The docs have examples that can give you some early tips on getting started.
This is the code I am using
MINIMUM_ORDER_AMOUNT = 90 #dollars required in cart to get discount
MESSAGE = "Free shipping if order is over $100" #promotional message
if Input.cart.shipping_address.country.include?("United States")
if Input.cart.subtotal_price_was >= (Money.new(cents:100) * MINIMUM_ORDER_AMOUNT)
Input.shipping_rates.each do |shipping_rate|
next unless shipping_rate.source == "shopify"
shipping_rate.apply_discount(shipping_rate.price, message: MESSAGE)
Output.shipping_rates = Input.shipping_rates