mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
Use transaction id from parent order on first renewal
This commit is contained in:
parent
d3b319ab11
commit
ca9fb3e9fa
1 changed files with 5 additions and 1 deletions
|
@ -113,8 +113,12 @@ class SubscriptionModule implements ModuleInterface {
|
|||
if ( is_a( $latest_subscription, WC_Subscription::class ) ) {
|
||||
$related_renewal_orders = $latest_subscription->get_related_orders( 'ids', 'renewal' );
|
||||
$latest_order_id_with_transaction = array_slice( $related_renewal_orders, 1, 1, false );
|
||||
$order_id = ! empty( $latest_order_id_with_transaction ) ? $latest_order_id_with_transaction[0] : 0;
|
||||
if ( count( $related_renewal_orders ) === 1 ) {
|
||||
$order_id = $latest_subscription->get_parent_id();
|
||||
}
|
||||
|
||||
$wc_order = wc_get_order( $latest_order_id_with_transaction[0] );
|
||||
$wc_order = wc_get_order( $order_id );
|
||||
if ( is_a( $wc_order, WC_Order::class ) ) {
|
||||
$transaction_id = $wc_order->get_transaction_id();
|
||||
$data['application_context']['stored_payment_source'] = array(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue