Skip to content

Instantly share code, notes, and snippets.

@dommmel
Last active December 12, 2017 14:48
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save dommmel/5d536f4e3a42b1e3d5c975c1510a5f2a to your computer and use it in GitHub Desktop.
Shopify Script to enable payment gateway only for customer with a certain tag
PAYMENT_GATEWAY_NAME = 'Invoice'
CUSTOMER_TAG = 'VIP'
customer = Input.cart.customer
remove_gateway = (customer.nil? or !customer.tags.include?(CUSTOMER_TAG))
if remove_gateway
Output.payment_gateways = Input.payment_gateways.delete_if do |payment_gateway|
payment_gateway.name == PAYMENT_GATEWAY_NAME
end
else
Output.payment_gateways = Input.payment_gateways
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment