Remove & Show Payment Gateways based on if a Custom Item has been added

New Member
1 0 0

We are using a script to remove payment gateways based on cart content so that initially when a customer puts together an order of a certain combination of qtys and product tags requires us to quote additional fees, they do not pay until we have added additional fees. We are using product tags and qtys to determine if Shopify Pay or Manual Payment Method should show and this is working for the initial checkout process.

However, after the initial checkout process, we then edit the order by adding a custom item for the additional fees, and we now get a runtime error for the payment gateway script as the payment gateway script is based on product tags and custom items don't have product tags.

We basically want a payment gateway script that does the following

1. IF a custom item has been added to order regardless of cart content, show Shopify Pay only -- not the manual payment method

2. IF all items have product tag _Ground, show Shopify Pay only -- not the manual payment method

3. IF large order (more than qty 5 products with _HomeDelivery tag or more than qty 20 products with _Ground tag OR if qty 1 or more product with _HomeDelivery tag and more than 10 products with _Ground tag) and no custom items have been added, show only manual payment method -- not Shopify Pay

4. IF large order (as defined above) and custom items have been added, show Shopify Pay only -- and not the manual payment method

In all other cases, both Shopify Pay and Manual Payment Method can show.