Merge pull request #14755 from woocommerce/fix/14736

On multisite, add user to blog during checkout if not a user
This commit is contained in:
Mike Jolley 2017-04-27 17:46:54 +01:00 committed by GitHub
commit 56d190287e
1 changed files with 5 additions and 0 deletions

View File

@ -840,6 +840,11 @@ class WC_Checkout {
WC()->cart->calculate_totals();
}
// On multisite, ensure user exists on current site, if not add them before allowing login.
if ( $customer_id && is_multisite() && is_user_logged_in() && ! is_user_member_of_blog() ) {
add_user_to_blog( get_current_blog_id(), $customer_id, 'customer' );
}
// Add customer info from other fields.
if ( $customer_id && apply_filters( 'woocommerce_checkout_update_customer_data', true, $this ) ) {
$customer = new WC_Customer( $customer_id );