Skip to content

Instantly share code, notes, and snippets.

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 jimmijazz/369374e1af87c8fbcc65606a3c42ec27 to your computer and use it in GitHub Desktop.
Save jimmijazz/369374e1af87c8fbcc65606a3c42ec27 to your computer and use it in GitHub Desktop.
tag = "hide" # If any line items have this tag, the gateway would be hidden
payment_gateways = ["Credit card", "BitPay"] # Any gateways in this array will be hidden
hide = false
Input.cart.line_items.each do |item|
if item.variant.product.tags.include?(tag)
hide = true
break
end
end
if hide == true
Output.payment_gateways = Input.payment_gateways.delete_if do |payment_gateway|
payment_gateways.include?(payment_gateway.name)
end
end
Output.payment_gateways = Input.payment_gateways
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment