Force Minimum Password Length at Checkout

function sumobi_edd_set_minimum_password_length( $valid_data, $post_data ) { // how many characters should the password be? $length = 8; if ( strlen( $post_data[‘edd_user_pass’] ) < $length ) { edd_set_error( 'password_too_short', sprintf( __( 'Please enter a password of %s characters or more.', 'edd'…Continue reading

Disable PayPal for Multi-Item Checkout

function pw_edd_disable_paypal_on_multi_item_checkout( $gateways ) { global $wp_query; if ( ! empty( $wp_query ) && edd_is_checkout() && count( edd_get_cart_contents() ) > 1 ) { $paypal_gateways = array( ‘paypal’, ‘paypalexpress’, ‘paypalpro’, ‘paypal_commerce’, ); foreach ( $paypal_gateways as $paypal ) { if (…Continue reading

Remove Discount Field

function pw_edd_remove_discount_field() { remove_action( ‘edd_checkout_form_top’, ‘edd_discount_field’, -1 ); } add_action( ‘init’, ‘pw_edd_remove_discount_field’ );Continue reading

Prevent Duplicate Cart Items

function pw_edd_prevent_duplicate_cart_items( $download_id, $options ) { if( edd_item_in_cart( $download_id, $options ) ) { if( edd_is_ajax_enabled() && defined(‘DOING_AJAX’) && DOING_AJAX ) { die(‘1’); } else { wp_redirect( edd_get_checkout_uri() ); exit; } } } add_action( ‘edd_pre_add_to_cart’, ‘pw_edd_prevent_duplicate_cart_items’, 10, 2 );Continue reading

Hide Payment Icons When Free

function sumobi_edd_hide_payment_icons() { $cart_total = edd_get_cart_total(); if ( $cart_total ) return; remove_action( ‘edd_payment_mode_top’, ‘edd_show_payment_icons’ ); remove_action( ‘edd_checkout_form_top’, ‘edd_show_payment_icons’ ); } add_action( ‘template_redirect’, ‘sumobi_edd_hide_payment_icons’ );Continue reading

Force Billing Address

/** * Always force the billing address to show at checkout. */ function prefix_edd_force_billing_address() { // If the cart already needs tax address fields, don’t force the billing address. if ( edd_cart_needs_tax_address_fields() ) { return; } if ( ! did_action(…Continue reading

Send Sale Alerts From Customer Email

class EDD_SAFCE { public function __construct() { add_action( ‘edd_admin_sale_notice’, array( $this, ‘set_payment_id’ ), -1000, 2 ); add_action( ‘edd_email_send_before’, array( $this, ‘set_from_address’ ) ); } public function set_payment_id( $payment_id, $payment_data ) { global $edd_payment_id; $edd_payment_id = $payment_id; } public function set_from_address(…Continue reading