How to conditionally remove a payment option from checkout?

How to conditionally remove a payment option from checkout?

birdyoung33
Shopify Partner
2 0 0

Just looking for some guidance on this.

Let's say I have a product id of 7025617862758 and payments options that are Credit Card and AfterPay. When this product has been added to the cart, regardless of what other products are in the cart, I'd like to hide the AfterPay payment option, and only allow for Credit Card.

I was thinking of creating an app for this (I have no experience doing so), and then using graphql to do a cart query to check what products it has. If that ID is in the cart then remove the payment option.

Does this sound like the correct approach? or am I over complicating it?

Replies 3 (3)

ssdc
Shopify Partner
32 1 7

Need Shopify Plus for this

Shopify Expert based in Indonesia. Visit our website ssdc.co
birdyoung33
Shopify Partner
2 0 0

Yeah I'm using shopify plus, just a dev environment site 

AlexHeard
Shopify Partner
64 0 1

You can conditionally remove a payment option from checkout using the PayRules: Hide Payment Methods app. Here's how you can do it:

 

  1. Add "AfterPay" in the "Additional payment methods" field.
  2. In the "Products" field, select "Hide if found" and add the specific product.

afterpay.png

This will ensure that the AfterPay option is hidden when the specified product is in the cart.