Fix subscription initial payment method name

This commit is contained in:
Pedro Silva 2024-02-05 18:26:41 +00:00
parent 9f859da8cb
commit 8266e1bce7
No known key found for this signature in database
GPG key ID: E2EE20C0669D24B3
2 changed files with 11 additions and 2 deletions

View file

@ -326,8 +326,6 @@ const PayPalComponent = ({
};
handleSubscriptionShippingChange = async (data, actions) => {
console.log('--- handleSubscriptionShippingChange', data, actions);
try {
const shippingOptionId = data.selected_shipping_option?.id;
if (shippingOptionId) {

View file

@ -111,6 +111,17 @@ class WcSubscriptionsModule implements ModuleInterface {
$subscription->update_meta_data( 'ppcp_previous_transaction_reference', $transaction_id );
$subscription->save();
}
// Update the initial payment method title if not the same as the first order.
$payment_method_title = $parent_order->get_payment_method_title();
if (
$payment_method_title
&& $subscription instanceof \WC_Subscription
&& $subscription->get_payment_method_title() !== $payment_method_title
) {
$subscription->set_payment_method_title( $payment_method_title );
$subscription->save();
}
}
}
}