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

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

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

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

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

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