Skip to content

Instantly share code, notes, and snippets.

Avatar

David Ryan dryan1144

View GitHub Profile
@dryan1144
dryan1144 / update_ck_with_customer_tag.php
Created Nov 28, 2020
Subscribe user to Convertkit tag after EDD purchase
View update_ck_with_customer_tag.php
<?php
add_action( 'edd_complete_purchase', 'draw_update_ck_with_customer_tag' );
function draw_update_ck_with_customer_tag( $payment_id ) {
$ck_customer_tag_id = 1234;
$edd_payment = new EDD_Payment($payment_id);
View edd_convertkit_complete_purchase.php
<?php
/***
Update Convertkit email with a Convertkit tag based on EDD download ID
Conditionally set Convertkit tag ID based on EDD download ID
***/
add_action( 'edd_complete_purchase', 'drw_update_ck_after_edd_purchase' );
@dryan1144
dryan1144 / edd_add_email_tags.php
Last active Nov 27, 2020
Easy Digital Downloads Developer Hooks
View edd_add_email_tags.php
<?php
/***
edd_add_email_tags
Add custom email tags for use in EDD email templates
***/
View edd_insert_user.php
<?php
/***
Remove new user notification emails in EDD
***/
remove_action( 'edd_insert_user', 'edd_new_user_notification', 10, 2 );
View edd_default_downloads_name.php
<?php
function drw_edd_global_labels($labels) {
$labels = array(
'singular' => __('Product','edd'),
'plural' => __('Products','edd')
);
return $labels;
View edd_payment_receipt_before.php
<?php
function drw_purchase_confirmation_text( $payment, $edd_receipt_args ) {
$payment = new EDD_Payment($payment->ID);
$downloads = $payment->downloads;
$gateway = $payment->gateway; //stripe //check
$gateway_text = ( 'stripe' == $gateway ) ? __('Credit Card', 'drw') : __('Check', 'drw');
printf('<div class="message">%s %s</div>', __('You have paid by'), $gateway_text);
View edd_add_email_tags.php
<?php
/***
Add custom email tags for use in EDD email templates
***/
function drw_edd_add_email_tags() {
edd_add_email_tag('product_message', __('Custom product message','drw'), 'drw_product_message_email_tag');
@dryan1144
dryan1144 / edd_recurring_update_subscription.php
Last active Nov 27, 2020
Subscription update callback for Recurring Payments EDD extension
View edd_recurring_update_subscription.php
<?php
/***
Make API call if Recurring Payments subscription status has changed
**/
add_action( 'edd_recurring_update_subscription', 'drw_subscription_update_callback', 10, 1);
function drw_subscription_update_callback( $subscription_id = null ) {
@dryan1144
dryan1144 / edd_update_payment_status.php
Created Nov 26, 2020
EDD callback for payment status updates
View edd_update_payment_status.php
<?php
/***
Actions after purchase status is changed - useful for check payments
***/
function drw_edd_after_check_purchase( $payment_id, $new_status, $old_status ) {
//bail if the order isn't approved
if ( !in_array($new_status, array('publish', 'complete')) ) {
View edd_complete_purchase.php
<?php
/***
Do something with payment data after purchase
***/
function drw_api_call_after_purchase( $payment_id ) {
$payment_meta = edd_get_payment_meta( $payment_id );
You can’t perform that action at this time.