Skip to content

Instantly share code, notes, and snippets.

@jdeeburke jdeeburke/functions.php
Last active Jan 12, 2020

Embed
What would you like to do?
Jilt for EDD Manual Payments Compatibility Snippet
<?php
// Add this to your theme's functions.php file or use a plugin
// like Code Snippets - https://wordpress.org/plugins/code-snippets/
add_action( 'edd_payment_saved', function( $payment_id, $payment ) {
// EDD Manual Payment callback
if ( doing_action( 'edd_create_payment' ) ) {
if ( ! $payment->get_meta( '_edd_jilt_cart_token' ) ) {
// Generate cart token (also assigns to user session)
$cart_token = edd_jilt()->get_cart_handler()->get_cart_token();
// Add cart tokent to the manual payment
$payment->update_meta( '_edd_jilt_cart_token', $cart_token );
// Remove the cart token from the current user's session
EDD_Jilt_Session::unset_jilt_order_data();
}
}
}, 10, 2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.