From 12a0ebfef20d2a3bd9c23b6f8859e8544a2a1496 Mon Sep 17 00:00:00 2001 From: bdmehedi Date: Tue, 14 Jun 2022 16:45:25 +0600 Subject: [PATCH] Added bundle product download link for bundle purchase --- includes/Edd/SendRequests.php | 10 +++++--- includes/Edd/ThankYouPage.php | 31 ++++++++++++++++++++++++ includes/WooCommerce/SendRequests.php | 9 ++++--- includes/WooCommerce/ThankYouPage.php | 35 ++++++++++++++++++++++++++- 4 files changed, 78 insertions(+), 7 deletions(-) diff --git a/includes/Edd/SendRequests.php b/includes/Edd/SendRequests.php index fbc31f9..3ac3db4 100644 --- a/includes/Edd/SendRequests.php +++ b/includes/Edd/SendRequests.php @@ -125,15 +125,19 @@ private function send_delete_order_and_license_request( $payment, $download_id ) private function save_license_response( $response, $payment_id, $download_id ) { if ( isset( $response['data'] ) && isset( $response['data']['source_id'] ) ) { $key = '_appsero_order_license_for_product_' . $download_id; - - update_post_meta( $payment_id, $key, [ + $data = [ 'source_id' => $response['data']['source_id'], 'key' => $response['data']['key'], 'status' => $response['data']['status'], 'download_url' => $response['data']['download_url'], 'expire_date' => $response['data']['expire_date'], 'send_license' => isset( $response['data']['send_license'] ) ? $response['data']['send_license'] : true, - ] ); + ]; + if ( isset( $response['data']['bundleProducts'] ) ) { + $data['bundle_products'] = $response['data']['bundleProducts']; + } + + update_post_meta( $payment_id, $key, $data ); } } diff --git a/includes/Edd/ThankYouPage.php b/includes/Edd/ThankYouPage.php index 94fbbe2..abe04cc 100644 --- a/includes/Edd/ThankYouPage.php +++ b/includes/Edd/ThankYouPage.php @@ -55,6 +55,10 @@ public function show_license_and_download( $payment_post, $receipt_args ) { license_and_download_item( $license ); + if (! isset( $license['bundle_products'] )) { + continue; + } + $this->show_bundle_products( $license ); } ?> @@ -88,4 +92,31 @@ private function license_and_download_item( $license ) { + + + Products in + + + + + + + + + .zip + + + + + $response['data']['source_id'], 'key' => $response['data']['key'], 'status' => $response['data']['status'], 'download_url' => $response['data']['download_url'], 'expire_date' => $response['data']['expire_date'], 'send_license' => isset( $response['data']['send_license'] ) ? $response['data']['send_license'] : true, - ] ); + ]; + if ( isset( $response['data']['bundleProducts'] ) ) { + $data['bundle_products'] = $response['data']['bundleProducts']; + } + update_post_meta( $order_id, $key, $data ); } } diff --git a/includes/WooCommerce/ThankYouPage.php b/includes/WooCommerce/ThankYouPage.php index d52b96f..beadb71 100644 --- a/includes/WooCommerce/ThankYouPage.php +++ b/includes/WooCommerce/ThankYouPage.php @@ -73,11 +73,44 @@ public function show_license_and_download( $order_id ) { - + show_bundle_products( $license ); + endforeach; + ?> + + + Products in + + + + + + + + + .zip + + + + +