Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement