Skip to content

Instantly share code, notes, and snippets.

View SeanTOSCD's full-sized avatar
👋
Reach out.

Sean Davis SeanTOSCD

👋
Reach out.
View GitHub Profile
@SeanTOSCD
SeanTOSCD / file.php
Created August 29, 2017 13:38
EDD hide quantity field on purchase form only
<?php // DO NOT COPY THIS LINE
function sd_remove_purchase_form_qty( $output ) {
$output = '';
return $output;
}
add_filter( 'edd_purchase_form_quantity_input', 'sd_remove_purchase_form_qty' );
@SeanTOSCD
SeanTOSCD / file.php
Created August 25, 2017 19:00
EDD External Products open in new tab
<?php // DO NOT COPY THIS LINE
function sd_edd_external_products_product_links( $purchase_form, $args ) {
if( $url = get_post_meta( $args['download_id'], '_edd_external_product_url', true ) ) {
$label = get_post_meta( $args['download_id'], '_edd_external_product_button', true );
$purchase_form = '<div class="edd_download_purchase_form">';
$purchase_form .= '<div class="edd_purchase_submit_wrapper">';
$purchase_form .= sprintf(
@SeanTOSCD
SeanTOSCD / file.php
Created August 23, 2017 15:57
EDD remove first name from checkout
<?php // DO NOT COPY THIS LINE
function pw_edd_purchase_form_required_fields( $required_fields ) {
unset( $required_fields['edd_first'] );
return $required_fields;
}
add_filter( 'edd_purchase_form_required_fields', 'pw_edd_purchase_form_required_fields' );
@SeanTOSCD
SeanTOSCD / file.js
Created July 27, 2017 21:15
EDD checkout login form hack - 2
// Checkout form login toggle
$('.edd-checkout-show-login-form').on('click',function(e){
e.preventDefault();
$(this).parents( ".edd-show-login-wrap" ).siblings( "#edd_login_fields" ).show();
$( "#edd_login_fields #edd_user_login" ).focus();
});
@SeanTOSCD
SeanTOSCD / file.php
Created July 27, 2017 21:11
EDD checkout login form hack
<?php
/**
* Place checkout login form behind a toggle link
*/
function eddwp_checkout_login_toggle() {
if ( is_user_logged_in() ) {
return;
}
?>
@SeanTOSCD
SeanTOSCD / file.php
Created July 27, 2017 15:45
EDD SL add discount code to email renewal link
<?php // DO NOT COPY THIS LINE
// add discount code Software Licensing renewal email {renewal_link} tag
function edd_sl_renewal_link_discount( $url ) {
$url = $url . '&discount=DISCOUNTCODE';
return $url;
}
add_filter( 'edd_sl_renewal_link', 'edd_sl_renewal_link_discount' );
<?php // DO NOT COPY THIS LINE
/*
* This snippet forces the billing address to always be collected at checkout
*/
function pw_edd_force_billing_address() {
if( ! did_action( 'edd_after_cc_fields', 'edd_default_cc_address_fields' ) ) {
edd_default_cc_address_fields();
}
}
@SeanTOSCD
SeanTOSCD / file.txt
Created July 17, 2017 21:09
EDD remove downloads shortcode excerpt ellipses
Find this line (twice)
<?php echo apply_filters( 'edd_downloads_excerpt', wp_trim_words( get_post_field( 'post_excerpt', get_the_ID() ), $excerpt_length ) ); ?>
Replace it with this line (again, twice)
<?php echo apply_filters( 'edd_downloads_excerpt', wp_trim_words( get_post_field( 'post_excerpt', get_the_ID() ), $excerpt_length, '' ) ); ?>
@SeanTOSCD
SeanTOSCD / file.php
Created July 4, 2017 18:11
EDD PayPal Locale Code
<?php // DO NOT COPY THIS LINE
function sd_paypal_locale_code( $paypal_args ) {
// replace fr_XC with the Locale Code you need
// https://developer.paypal.com/docs/classic/api/locale_codes/#supported-locale-codes
$paypal_args['lc'] = 'fr_XC';
return $paypal_args;
}
add_filter( 'edd_paypal_redirect_args', 'sd_paypal_locale_code' );
@SeanTOSCD
SeanTOSCD / file.php
Created June 29, 2017 14:28
EDD SL get expired licenses
<?php
// check for expired licenses
$license_args = array(
'posts_per_page' => -1,
'post_type' => 'edd_license',
'post_status' => 'any',
'meta_query' => array(
'relation' => 'AND',
array(