| @@ 367-379 (lines=13) @@ | ||
| 364 | $stripe_customer_id = get_post_meta( ( WC_Stripe_Helper::is_pre_30() ? $subscription->id : $subscription->get_id() ), '_stripe_customer_id', true ); |
|
| 365 | ||
| 366 | // If we couldn't find a Stripe customer linked to the subscription, fallback to the user meta data. |
|
| 367 | if ( ! $stripe_customer_id || ! is_string( $stripe_customer_id ) ) { |
|
| 368 | $user_id = $customer_user; |
|
| 369 | $stripe_customer_id = get_user_meta( $user_id, '_stripe_customer_id', true ); |
|
| 370 | $stripe_source_id = get_user_meta( $user_id, '_stripe_source_id', true ); |
|
| 371 | ||
| 372 | // For BW compat will remove in future. |
|
| 373 | if ( empty( $stripe_source_id ) ) { |
|
| 374 | $stripe_source_id = get_user_meta( $user_id, '_stripe_card_id', true ); |
|
| 375 | ||
| 376 | // Take this opportunity to update the key name. |
|
| 377 | update_user_meta( $user_id, '_stripe_source_id', $stripe_source_id ); |
|
| 378 | } |
|
| 379 | } |
|
| 380 | ||
| 381 | // If we couldn't find a Stripe customer linked to the account, fallback to the order meta data. |
|
| 382 | if ( ( ! $stripe_customer_id || ! is_string( $stripe_customer_id ) ) && false !== $subscription->order ) { |
|
| @@ 439-451 (lines=13) @@ | ||
| 436 | $stripe_customer_id = get_post_meta( ( WC_Stripe_Helper::is_pre_30() ? $subscription->id : $subscription->get_id() ), '_stripe_customer_id', true ); |
|
| 437 | ||
| 438 | // If we couldn't find a Stripe customer linked to the subscription, fallback to the user meta data. |
|
| 439 | if ( ! $stripe_customer_id || ! is_string( $stripe_customer_id ) ) { |
|
| 440 | $user_id = $customer_user; |
|
| 441 | $stripe_customer_id = get_user_meta( $user_id, '_stripe_customer_id', true ); |
|
| 442 | $stripe_source_id = get_user_meta( $user_id, '_stripe_source_id', true ); |
|
| 443 | ||
| 444 | // For BW compat will remove in future. |
|
| 445 | if ( empty( $stripe_source_id ) ) { |
|
| 446 | $stripe_source_id = get_user_meta( $user_id, '_stripe_card_id', true ); |
|
| 447 | ||
| 448 | // Take this opportunity to update the key name. |
|
| 449 | update_user_meta( $user_id, '_stripe_source_id', $stripe_source_id ); |
|
| 450 | } |
|
| 451 | } |
|
| 452 | ||
| 453 | // If we couldn't find a Stripe customer linked to the account, fallback to the order meta data. |
|
| 454 | if ( ( ! $stripe_customer_id || ! is_string( $stripe_customer_id ) ) && false !== $subscription->order ) { |
|