Created
September 16, 2021 21:37
-
-
Save procarrera/406ed778e91d39b1489dd29bcc42bb02 to your computer and use it in GitHub Desktop.
SHOPIFY : Hide a specific Gateway Method for customers not tagged with a given 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
customer = Input.cart.customer | |
puts(customer) | |
if customer | |
if customer.tags.include? 'TEST' | |
Output.payment_gateways = Input.payment_gateways | |
else | |
Output.payment_gateways = Input.payment_gateways.delete_if do |payment_gateway| | |
payment_gateway.name == 'Pay on pickup' | |
end | |
end | |
else | |
Output.payment_gateways = Input.payment_gateways.delete_if do |payment_gateway| | |
payment_gateway.name == 'Pay on pickup' | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment