Add terms to downloads shortcode

function sd_edd_downloads_shortcode_display_terms() { $post_id = get_the_ID(); // use “download_category” for categories and “download_tag” for tags the_terms( $post_id, ‘download_category’, ‘Categories: ‘, ‘, ‘, ” ); } add_action( ‘edd_download_after’, ‘sd_edd_downloads_shortcode_display_terms’ );Continue reading

Prevent Discounts on Upgrades

function pw_edd_disable_discount_on_upgrade( $return ) { $cart_items = edd_get_cart_contents(); if ( $cart_items ) { foreach ( $cart_items as $item ) { if ( isset( $item[‘options’][‘is_upgrade’] ) ) { $error_message = __( ‘Discounts are not valid when upgrading.’, ‘edd’ ); edd_set_error( ‘edd-discount-error’,…Continue reading

Prevent Discounts on Renewals

function kfg_check_if_is_renewal( $return, $discount_id ) { // Check if the discount code is valid and is not for renewals. if ( EDD()->session->get( ‘edd_is_renewal’ ) ) { edd_set_error( ‘edd-discount-error’, __( ‘This discount is not valid with renewals.’, ‘edd’ ) ); return…Continue reading

Limit Purchase Total

function pw_edd_limit_total_purchase() { if( edd_get_cart_total() > 100 ) { edd_set_error( ‘too_much’, ‘You cannot purchase that much at one time.’ ); } } add_action( ‘edd_checkout_error_checks’, ‘pw_edd_limit_total_purchase’ );Continue reading

Checkout Cart Thumbnail Size

function edd_custom_change_checkout_thumb_image_size( $dimensions ) { $dimensions = array( 60, 60 ); // array( width, height ) in pixels return $dimensions; } add_filter( ‘edd_checkout_image_size’, ‘edd_custom_change_checkout_thumb_image_size’ );Continue reading

Non-required Card State

function pw_edd_remove_state_from_required_fields( $fields ) { if( array_key_exists( ‘card_state’, $fields ) ) { unset( $fields[‘card_state’] ); } return $fields; } add_filter( ‘edd_purchase_form_required_fields’, ‘pw_edd_remove_state_from_required_fields’ );Continue reading

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

Custom Cart Expiration

/* * Sets the cart expiration to 48 hours */ function pw_edd_set_cart_expiration( $seconds ) { return 172800; // 48 hours in seconds } add_filter( ‘wp_session_expiration’,’pw_edd_set_cart_expiration’, 999990 );Continue reading

Force account creation by cart total

function sumobi_edd_force_account_creation_by_cart_total( $ret ) { // enter the cart total amount that should force account creation $limit = 100; // get the cart total $cart_total = edd_get_cart_total(); if ( $cart_total >= $limit ) { // if the cart total is…Continue reading

Billing Address Email Tag – Actual Country Name

function pj_edd_billing_address_tag( $payment_id ) { edd_remove_email_tag( ‘billing_address’ ); edd_add_email_tag( ‘billing_address’, __( ‘The buyer\’s billing address’, ‘easy-digital-downloads’ ), ‘pj_edd_billing_address_tag_callback’ ); } add_action( ‘edd_add_email_tags’, ‘pj_edd_billing_address_tag’, 99 ); function pj_edd_billing_address_tag_callback( $payment_id ) { $user_info = edd_get_payment_meta_user_info( $payment_id ); $user_address = ! empty( $user_info[‘address’]…Continue reading