Personalized checkout and custom promotions with Shopify Scripts
We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more
Hi all
I'm hoping someone can help with this one! When using .first with the below shipping script to attempt to isolate the cheapest expedited rate, the shipping rate name is not returned, but rather "#<ShippingRate:0x7XXXXXXXXX0>" so I cannot isolate which expedited rate is the cheapest (or at least not to my knowledge).
ELIGIBLE_RATE = Input.shipping_rates.each do |shipping_rate| if shipping_rate.name.include?("Expedited") end end ELIGIBLE_RATE = ELIGIBLE_RATE.sort_by!(&:price) LOWESTRATE = ELIGIBLE_RATE.first
Does anyone have any tips or examples for this or maybe has a better suggestion on isolating the cheapest expedited rate? The rates are live carrier rates so they change each time. Using something fixed is unfortunately not an option.