Adjust Rate for Referrals

/* * This is for combining EDD Commissions with Affiliates Pro */ function pw_edd_adjust_commission_rate_for_referrals( $recipient, $commission_amount, $rate, $download_id, $commission_id, $payment_id ) { global $wpdb; // See if this payment had a referral associated with it if( $wpdb->get_var( $wpdb->prepare( “SELECT referral_id…Continue reading

Commissions payment_id email tag

function pj_eddc_add_payment_id_email_template_tag( $message, $user_id, $commission_amount, $rate, $download_id, $commission_id ){ //Get the payment Id $payment_id = get_post_meta( $commission_id, ‘_edd_commission_payment_id’, true ); $message = str_replace( ‘{payment_id}’, $payment_id, $message ); return $message; } add_filter( ‘eddc_sale_alert_email’, ‘pj_eddc_add_payment_id_email_template_tag’, 10, 6 );Continue reading

Show Invoice for Refunded

function pw_edd_pdf_invoices_for_refunded( $show_invoice, $payment_id ) { $payment = get_post( $payment_id ); $status = edd_get_payment_status( $payment ); if( ‘refunded’ === $status ) { $show_invoice = true; } return $show_invoice; } add_filter( ‘eddpdfi_is_invoice_link_allowed’, ‘pw_edd_pdf_invoices_for_refunded’, 10, 2 );Continue reading

Show Invoice for Pending

function pw_edd_pdf_invoices_for_pending( $show_invoice, $payment_id ) { $payment = get_post( $payment_id ); $status = edd_get_payment_status( $payment ); if( ‘pending’ === $status ) { $show_invoice = true; } return $show_invoice; } add_filter( ‘eddpdfi_is_invoice_link_allowed’, ‘pw_edd_pdf_invoices_for_pending’, 10, 2 );Continue reading

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

Download count shortcode

// Optional attributs supported : id, offset function edd_download_count_shortcode( $atts ) { if( function_exists( ‘edd_get_download_sales_stats’ ) ) { $post_id = get_the_ID(); $a = shortcode_atts( array( ‘offset’ => 0, ‘id’ => $post_id, ), $atts ); $download_count = edd_get_download_sales_stats( $a[‘id’] ) +…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

Continue Shopping Button

add_action( ‘edd_cart_footer_buttons’, ‘ck_edd_continue_shopping_button’, 1 ); function ck_edd_continue_shopping_button() { $color = edd_get_option( ‘checkout_color’, ‘green’ ); $color = ( $color == ‘inherit’ ) ? ” : $color; ?> “>Continue reading