Once the Conditional Gateways extension is installed and activated, a new meta box will be added to the New Downloads and Edit Downloads pages entitled “Conditional Gateways”. The Conditional Gateways meta box can be found at the bottom of the right of the page above the featured/download image, by default, and looks like this:
The meta box will list all of the currently active gateways on your Easy Digital Downloads install. By default, all gateways are allowed for every product. To restrict a download to a specific gateway or gateways, simply check them and hit save! In this example, Paypal and Stripe are the only active gateways.
Configuring Conditional Gateways
Beyond the per-download configuration already discussed, the Conditional Gateway extension requires very little configuration. At present, it only supports a single option which can be found under Downloads→Settings→Payment Gateways→Conditional Gateways.
This option allows you to configure the error message shown in any case where a user may add a combination of products to their cart which results in no gateways being available.
How Conditional Gateways works
By default, Easy Digital Downloads allows you to implement an unlimited number of gateways on your site. For the purposes of this documentation, we are going to assume that you have two active gateways, Paypal Standard and Stripe Standard or Stripe Pro. Now let’s assume that you are an author and are selling ebooks through your website, along with other digital goods. The Paypal Terms of Service explicitly disallows selling ebooks through their gateway so, for your ebooks, you would want to disable the Paypal gateway.
Now, if a user adds an ebook and another digital product to their cart, the system will run through each product in the cart and tally up the allowed gateways for each product. Since the non-ebook product allows both Paypal and Stripe, but the ebook only allows Stripe, the EDD checkout page will only list Stripe. If, however, you have configured all non-ebook products to ONLY allow payment through Paypal, and a user has added the previously mentioned products to the cart, Conditional Gateways will run through the products in the cart and determine that there is no active gateway capable of processing all products in the cart. If this happens, the cart will display a notification (set through options page referenced above) to the user prompting them to remove an item from the cart and disable the checkout button until a valid gateway is found.