Shipping script customization ( Discount shipping rate if it's more than 75 )

AhmedGhaziii
Excursionist
28 0 9



AhmedGhaziii_1-1686148313607.png

I need help editing this script 
If shipping_rate.price is greater than 75 make it 75
because we have 3 different locations that have 3 different shipping rate = 75 
but we are in a small country and we want to make our shipping rate flat 75 no matter if customer picked items from different locations

but what is happening now that if the customer picked items from 3 location 

he will pay 75+75+75
We want him to pay only 75

 


I tried to use this code 

input.shipping_rates.each do |shipping_rate|
  next unless shipping_rate.source == "shopify"
  
  if shipping_rate.price > 75
    shipping_rate.price = 75
  end
  
 

output.shipping_rates = input.shipping_rates

 but it didn't work 

Replies 0 (0)