| @@ 441-453 (lines=13) @@ | ||
| 438 | $stripe_customer_id = get_post_meta( ( WC_Stripe_Helper::is_wc_lt( '3.0' ) ? $subscription->id : $subscription->get_id() ), '_stripe_customer_id', true ); |
|
| 439 | ||
| 440 | // If we couldn't find a Stripe customer linked to the subscription, fallback to the user meta data. |
|
| 441 | if ( ! $stripe_customer_id || ! is_string( $stripe_customer_id ) ) { |
|
| 442 | $user_id = $customer_user; |
|
| 443 | $stripe_customer_id = get_user_meta( $user_id, '_stripe_customer_id', true ); |
|
| 444 | $stripe_source_id = get_user_meta( $user_id, '_stripe_source_id', true ); |
|
| 445 | ||
| 446 | // For BW compat will remove in future. |
|
| 447 | if ( empty( $stripe_source_id ) ) { |
|
| 448 | $stripe_source_id = get_user_meta( $user_id, '_stripe_card_id', true ); |
|
| 449 | ||
| 450 | // Take this opportunity to update the key name. |
|
| 451 | update_user_meta( $user_id, '_stripe_source_id', $stripe_source_id ); |
|
| 452 | } |
|
| 453 | } |
|
| 454 | ||
| 455 | // If we couldn't find a Stripe customer linked to the account, fallback to the order meta data. |
|
| 456 | if ( ( ! $stripe_customer_id || ! is_string( $stripe_customer_id ) ) && false !== $subscription->order ) { |
|
| @@ 453-465 (lines=13) @@ | ||
| 450 | $stripe_customer_id = get_post_meta( ( WC_Stripe_Helper::is_wc_lt( '3.0' ) ? $subscription->id : $subscription->get_id() ), '_stripe_customer_id', true ); |
|
| 451 | ||
| 452 | // If we couldn't find a Stripe customer linked to the subscription, fallback to the user meta data. |
|
| 453 | if ( ! $stripe_customer_id || ! is_string( $stripe_customer_id ) ) { |
|
| 454 | $user_id = $customer_user; |
|
| 455 | $stripe_customer_id = get_user_meta( $user_id, '_stripe_customer_id', true ); |
|
| 456 | $stripe_source_id = get_user_meta( $user_id, '_stripe_source_id', true ); |
|
| 457 | ||
| 458 | // For BW compat will remove in future. |
|
| 459 | if ( empty( $stripe_source_id ) ) { |
|
| 460 | $stripe_source_id = get_user_meta( $user_id, '_stripe_card_id', true ); |
|
| 461 | ||
| 462 | // Take this opportunity to update the key name. |
|
| 463 | update_user_meta( $user_id, '_stripe_source_id', $stripe_source_id ); |
|
| 464 | } |
|
| 465 | } |
|
| 466 | ||
| 467 | // If we couldn't find a Stripe customer linked to the account, fallback to the order meta data. |
|
| 468 | if ( ( ! $stripe_customer_id || ! is_string( $stripe_customer_id ) ) && false !== $subscription->order ) { |
|