Hide payment icons for trials

function edd_library_maybe_show_payment_icons() { if ( edd_recurring()->cart_has_free_trial() ) { add_filter( ‘edd_get_option_accepted_cards’, ‘__return_false’ ); } } add_action( ‘init’, ‘edd_library_maybe_show_payment_icons’, 99 );Continue reading

Unlimited User Downloads for EDD Recurring

class EDD_Recurring_Unlimited_User_Downloads { function __construct() { if ( ! class_exists( ‘EDD_Recurring’ ) ) { return; } add_filter( ‘edd_recurring_download_has_access’, array( $this, ‘process_download’ ), 10, 4 ); add_action( ‘show_user_profile’, array( $this, ‘user_checkbox’ ) ); add_action( ‘edit_user_profile’, array( $this, ‘user_checkbox’ ) ); add_action(…Continue reading

Give Subscription on Purchase

function pw_edd_give_subscription_on_purchase( $payment_id ) { $user_id = edd_get_payment_user_id( $payment_id ); if( empty( $user_id ) || $user_id < 1 ) { return; } if( ! class_exists( 'EDD_Recurring_Customer' ) ) { return; } $customer = new EDD_Recurring_Customer; $customer->set_as_subscriber( $user_id ); $customer->set_customer_payment_id( $payment_id…Continue reading

Include Subscriptions in API

function pw_edd_recurring_include_payments_in_api( $query ) { if( ! defined( ‘EDD_DOING_API’ ) || ! EDD_DOING_API ) { return; } $query->__set( ‘post_status’, array( ‘publish’, ‘complete’, ‘edd_subscription’ ) ); } add_action( ‘edd_pre_get_payments’, ‘pw_edd_recurring_include_payments_in_api’, 100 );Continue reading

Replace Add to Cart With Download for Subscribers

add_filter( ‘edd_purchase_download_form’, ‘ck_edd_user_download_button_recurring’, 10, 2 ); function ck_edd_user_download_button_recurring( $purchase_form, $args ) { if( ! class_exists( ‘EDD_Recurring_Customer’ ) ) return $purchase_form; if( ! EDD_Recurring_Customer::is_customer_active( get_current_user_id() ) ) return $purchase_form; if ( !is_user_logged_in() ) return $purchase_form; $download_id = (string)$args[‘download_id’]; $current_user_id = get_current_user_id();…Continue reading

Auto Register Login Link

// replace the default WordPress login link in Auto Register email function custom_edd_auto_register_login_link( $default_email_body ) { // replace http://yoursite.com/sign-in with the URL you want to send users to $default_email_body = str_replace( wp_login_url(), ‘http://yoursite.com/sign-in’, $default_email_body ); return $default_email_body; } add_filter( ‘edd_auto_register_email_body’,…Continue reading

Company Field on Receipt

function pw_cfm_company_field( $payment, $edd_receipt_args ) { /* * TODO * * 1. Replace field label as appropriate * 2. Replace “company” with the meta_key entered in Checkout Fields Manager */ ?> :Continue reading

Disable Wish Lists by Category

function jp_disable_wish_list() { // replace category-goes-here below with your category slug if ( is_singular( ‘download’) && is_object_in_term( get_the_ID(), ‘download_category’, ‘category-slug-goes-here’ ) ) { remove_action( ‘edd_purchase_link_top’, ‘edd_wl_load_wish_list_link’ ); } } add_action( ‘template_redirect’, ‘jp_disable_wish_list’, 100 );Continue reading

Retroactive License Emails

/** * Initialize the plugin when an ajax call is made by the retroactive license * generation process. We don’t want to send out a duplicate email during the * normal purchase process, so this way the plugin does nothing…Continue reading

License Keys UL – Email Tag for Software Licensing

if ( ! defined( ‘ABSPATH’ ) ) exit; function my_custom_sl_emails_initialize(){ if ( class_exists( ‘EDD_SL_Emails’ ) ) { edd_add_email_tag( ‘license_keys_ul’, __( ‘Show all purchased licenses in an unordered list’, ‘edd_sl’ ), ‘my_custom_license_keys_ul_tag’ ); } } add_action( ‘init’, ‘my_custom_sl_emails_initialize’ ); function my_custom_license_keys_ul_tag(…Continue reading