Force account creation by category or tag

function sumobi_edd_force_account_creation_by_download_category_or_tag( $ret ) { // download categories that the download must belong to before account creation is forced $categories_to_search = array( ‘cat1’, ‘cat2’, ‘cat3’ ); // download tags that the download must belong to before account creation is forced…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

function pw_edd_force_billing_address() { if( ! did_action( ‘edd_after_cc_fields’, ‘edd_default_cc_address_fields’ ) ) { edd_default_cc_address_fields(); } } add_action( ‘edd_purchase_form_after_cc_form’, ‘pw_edd_force_billing_address’ );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

Simple Chained Products

/** * EDD_Chained_Products Class * * @since 1.0.0 */ class EDD_Chained_Products { public function __construct() { // Actions add_action( ‘init’, array( $this, ‘textdomain’ ) ); add_action( ‘edd_post_add_to_cart’, array( $this, ‘maybe_add_chained_product’ ), 10, 3 ); add_action( ‘edd_meta_box_settings_fields’, array( $this, ‘download_chained_setting’ ),…Continue reading

Limit Cart to One Item

function pw_edd_one_item_checkout( $download_id, $options ) { if( edd_get_cart_quantity() >= 1 ) { edd_empty_cart(); } } add_action( ‘edd_pre_add_to_cart’, ‘pw_edd_one_item_checkout’, 10, 2 );Continue reading