| @@ 391-403 (lines=13) @@ | ||
| 388 | $stripe_customer_id = get_post_meta( ( WC_Stripe_Helper::is_pre_30() ? $subscription->id : $subscription->get_id() ), '_stripe_customer_id', true ); |
|
| 389 | ||
| 390 | // If we couldn't find a Stripe customer linked to the subscription, fallback to the user meta data. |
|
| 391 | if ( ! $stripe_customer_id || ! is_string( $stripe_customer_id ) ) { |
|
| 392 | $user_id = $customer_user; |
|
| 393 | $stripe_customer_id = get_user_meta( $user_id, '_stripe_customer_id', true ); |
|
| 394 | $stripe_source_id = get_user_meta( $user_id, '_stripe_source_id', true ); |
|
| 395 | ||
| 396 | // For BW compat will remove in future. |
|
| 397 | if ( empty( $stripe_source_id ) ) { |
|
| 398 | $stripe_source_id = get_user_meta( $user_id, '_stripe_card_id', true ); |
|
| 399 | ||
| 400 | // Take this opportunity to update the key name. |
|
| 401 | update_user_meta( $user_id, '_stripe_source_id', $stripe_source_id ); |
|
| 402 | } |
|
| 403 | } |
|
| 404 | ||
| 405 | // If we couldn't find a Stripe customer linked to the account, fallback to the order meta data. |
|
| 406 | if ( ( ! $stripe_customer_id || ! is_string( $stripe_customer_id ) ) && false !== $subscription->order ) { |
|
| @@ 437-449 (lines=13) @@ | ||
| 434 | $stripe_customer_id = get_post_meta( ( WC_Stripe_Helper::is_pre_30() ? $subscription->id : $subscription->get_id() ), '_stripe_customer_id', true ); |
|
| 435 | ||
| 436 | // If we couldn't find a Stripe customer linked to the subscription, fallback to the user meta data. |
|
| 437 | if ( ! $stripe_customer_id || ! is_string( $stripe_customer_id ) ) { |
|
| 438 | $user_id = $customer_user; |
|
| 439 | $stripe_customer_id = get_user_meta( $user_id, '_stripe_customer_id', true ); |
|
| 440 | $stripe_source_id = get_user_meta( $user_id, '_stripe_source_id', true ); |
|
| 441 | ||
| 442 | // For BW compat will remove in future. |
|
| 443 | if ( empty( $stripe_source_id ) ) { |
|
| 444 | $stripe_source_id = get_user_meta( $user_id, '_stripe_card_id', true ); |
|
| 445 | ||
| 446 | // Take this opportunity to update the key name. |
|
| 447 | update_user_meta( $user_id, '_stripe_source_id', $stripe_source_id ); |
|
| 448 | } |
|
| 449 | } |
|
| 450 | ||
| 451 | // If we couldn't find a Stripe customer linked to the account, fallback to the order meta data. |
|
| 452 | if ( ( ! $stripe_customer_id || ! is_string( $stripe_customer_id ) ) && false !== $subscription->order ) { |
|