Today’s Ask Sell with WP question comes from Piotr:

How can I give discounts for using a payment method with Easy Digital Downloads? I want to encourage my customers to use something other than PayPal, so I want to give a discount for other payment methods or something to discourage paying in PayPal.


There’s a really useful Easy Digital Downloads extension that can help out you discount Easy Digital Downloads payment methods: Gateway Fees. This lets you add a fee based on which gateway is selected at checkout. This can let you easily charge a fee for a particular payment method when it’s selected at checkout.

You simply set the name of the fee, which will be displayed in the cart when it’s added, and the fee amount (whether it’s a flat fee or it’s based on a cart percentage). You can set this fee easily under Settings > Payment Gateways.

Easy Digital Downloads Gateway Fee

This could be used to add a $0.50 fee or similar for using PayPal, and it will be shown in the cart when added. This means that customers would have to pay $0.50 more just to use PayPal, encouraging the use of other payment methods.

However, you may not want to display this as a fee, and instead want to use a discount for other payment methods. The best part about the Easy Digital Downloads Fee API (which is what this extension uses) is that it accepts negative values.

You can add a negative flat fee for other payment methods, and this can serve as a discount for using those methods over PayPal. When customers select a non-PayPal method, the discount is applied, and when PayPal is selected, the discount is removed.

I like to make this more obviously, so you can add a simple notice below the payment method selector to do so:

function sww_add_paypal_payments_discount_notice() {

    $payment_mode = edd_get_chosen_gateway();

    if ( 'paypal' == $payment_mode ) {
        echo '<div class="edd-fee-notice">Please note: a $0.50 discount is applied when using another payment method.</div>';
    }
}
add_action( 'edd_purchase_form_top', 'sww_add_paypal_payments_discount_notice' );

(Use in functions.php or a custom plugin)

This adds a notice to checkout if PayPal is selected. You can change this to another payment mode if you’d like to change when the notice appears. If PayPal is selected, my checkout will tell customers that discounts are available for using other methods. Nothing will be displayed when a discounted method is selected.


EDD PayPal fee notice

PayPal notice



EDD Payment No Notice

No notice


You can style your notice however you’d like since we’ve given it the edd-fee-notice class. Here’s the CSS I’ve added to my stylesheet in this example, but you can adjust it or change these colors to match your theme.

.edd-fee-notice {
    background: #ed9c28;
    color: #fff;
    padding: 20px;
    border: 1px solid #e3921e;
}

When you use Gateway Fees with a custom notice like this, you can encourage customers to use a payment method you prefer without penalizing them with an additional fee for selecting PayPal.


Articles you may also like:

Posted by Beka Rice

Beka Rice manages the direction of Sell with WP content and writes or edits most of our articles to share her interests in eCommerce. Or she just writes as an excuse to spend more time jamming out to anything from The Clash to Lady Gaga. Who knows.