Skip to content

Instantly share code, notes, and snippets.

@HeyMehedi
Last active September 18, 2024 08:03
Show Gist options
  • Select an option

  • Save HeyMehedi/aba365e12695d9fdb1188069991e32d9 to your computer and use it in GitHub Desktop.

Select an option

Save HeyMehedi/aba365e12695d9fdb1188069991e32d9 to your computer and use it in GitHub Desktop.
Get Numbers of Orders after completing purchase for specific product
// Hook into EDD's purchase completion action
add_action( 'edd_complete_purchase', 'my_custom_complete_purchase', 10, 1 );
function my_custom_complete_purchase( $payment_id ) {
// Count Completed Payments
$completed_orders = edd_count_payments( [
'status' => 'publish',
'download' => 131665,
] );
error_log( ' $completed_orders->complete : ' . print_r( $completed_orders->complete, true ) );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment