Skip to content

Instantly share code, notes, and snippets.

@ashukasma
Created September 7, 2018 11:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ashukasma/f52bce339e082b2c0bd0ee5610e7aba0 to your computer and use it in GitHub Desktop.
Save ashukasma/f52bce339e082b2c0bd0ee5610e7aba0 to your computer and use it in GitHub Desktop.
Hide shipping for other than US country in Shopify Plus
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
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