- 
      
- 
        Save pippinsplugins/3966310 to your computer and use it in GitHub Desktop. 
    Retrieve the purchase ID based on the purchase key
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | <?php | |
| /** | |
| * Retrieve the purchase ID based on the purchase key | |
| * | |
| * @access public | |
| * @since 1.2.3 | |
| * | |
| * @param string $key the purchase key to search for | |
| * @return int $order_id | |
| */ | |
| function edd_get_purchase_id_by_key( $key ) { | |
| $payments = edd_get_payments( array( 'meta_key' => '_edd_payment_purchase_key', 'number' => 1 ) ); | |
| if ( $payments ) | |
| return $payments[0]->ID; | |
| return 0; | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment