You must be signed in to star a gist
Shopify Script to enable payment gateway only for customer with a certain tag
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
|PAYMENT_GATEWAY_NAME = 'Invoice'
|CUSTOMER_TAG = 'VIP'
|customer = Input.cart.customer
|remove_gateway = (customer.nil? or !customer.tags.include?(CUSTOMER_TAG))
|Output.payment_gateways = Input.payment_gateways.delete_if do |payment_gateway|
|payment_gateway.name == PAYMENT_GATEWAY_NAME
|Output.payment_gateways = Input.payment_gateways