Instantly share code, notes, and snippets.

Embed
What would you like to do?
Get Easy Digital Downloads to select a better landing page with PayPal Standard, and make your credit card customers happier. https://snippets.webaware.com.au/snippets/select-paypal-landing-page-for-easy-digital-downloads/
<?php
/*
Plugin Name: EDD PayPal Standard billing page
Plugin URI: https://gist.github.com/webaware/8751f3e4923ef5e24b322c89e04d385a
Description: Get Easy Digital Downloads to select a better landing page with PayPal Standard, and make your credit card customers happier.
Version: 1
Author: WebAware
Author URI: https://shop.webaware.com.au/
*/
/*
copyright (c) 2018 WebAware Pty Ltd (email : support@webaware.com.au)
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
if (!defined('ABSPATH')) {
exit;
}
add_filter('edd_paypal_redirect_args', function($args, $purchase) {
// select the Billing landing page, which makes the Credit Card fields more obvious
$args['landing_page'] = 'Billing';
// attempt to set the country code, for a better customer experience
if (!empty($purchase['post_data']['billing_country'])) {
$args['lc'] = $purchase['post_data']['billing_country'];
}
return $args;
}, 10, 2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment