Created
September 7, 2018 11:59
-
-
Save ashukasma/f52bce339e082b2c0bd0ee5610e7aba0 to your computer and use it in GitHub Desktop.
Hide shipping for other than US country in Shopify Plus
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
puts Input.cart.shipping_address.country_code | |
if Input.cart.shipping_address.country_code != 'US' | |
Output.shipping_rates = Input.shipping_rates.delete_if do |shipping_rate| | |
true | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BRAND = "Vendor_name" | |
if Input.cart.shipping_address.country_code != 'US' && Input.cart.line_items.any?{ | item | item.variant.product.vendor.include? BRAND} | |
Output.shipping_rates = Input.shipping_rates.delete_if do |shipping_rate| | |
true | |
end | |
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