FREE_TAG = ‘freeship’ PRODUCT_ID = 66854371656 if Input.cart.shipping_address.country_code == ‘US’ Input.cart.line_items.select do |line_item| product = line_item.variant.product if product.id == PRODUCT_ID PRODUCT_ID = true Input.shipping_rates.each do |shipping_rate| next unless shipping_rate.source == “shopify” shipping_rate.apply_discount(shipping_rate.price * 100, message: “Discounted shipping”) end end end end Output.shipping_rates = Input.shipping_rates
Related topics
| Topic | Replies | Views | Activity | |
|---|---|---|---|---|
| Update script to give free shipping based on customer tag and shipping address country | 3 | 24 | March 12, 2024 | |
| Show shopify shipping rate of customer location | 2 | 17 | February 5, 2024 | |
| FreeShipping set for both OTP and subscription when cart contains subscription product | 0 | 2 | April 8, 2024 | |
| How can I apply free shipping to specific products only? | 64 | 1428 | August 15, 2025 | |
| Convert shopify shipping script to shopify function to select shipping rate | 0 | 7 | May 9, 2024 |