/** * If shopping cart contains subscriptions, make sure a user can register on the checkout page * * @since 1.0 */ public static function make_checkout_registration_possible() { if (WC_Subscriptions_Cart::cart_contains_subscription() && !is_user_logged_in()) { // Make sure users can sign up if ('no' == get_option('woocommerce_enable_signup_and_login_from_checkout')) { update_option('woocommerce_enable_signup_and_login_from_checkout', 'yes'); self::$signup_option_changed = true; } // Make sure users are required to register an account if ('yes' == get_option('woocommerce_enable_guest_checkout')) { update_option('woocommerce_enable_guest_checkout', 'no'); self::$guest_checkout_option_changed = true; } } }
/** * If shopping cart contains subscriptions, make sure a user can register on the checkout page * * @since 1.0 */ public static function make_checkout_registration_possible($checkout = '') { if (WC_Subscriptions_Cart::cart_contains_subscription() && !is_user_logged_in()) { // Make sure users can sign up if (false === $checkout->enable_signup) { $checkout->enable_signup = true; self::$signup_option_changed = true; } // Make sure users are required to register an account if (true === $checkout->enable_guest_checkout) { $checkout->enable_guest_checkout = false; self::$guest_checkout_option_changed = true; if (!is_user_logged_in()) { $checkout->must_create_account = true; } } } }
/** * If shopping cart contains subscriptions, make sure a user can register on the checkout page * * @since 1.0 */ public static function make_checkout_registration_possible($checkout = '') { if (WC_Subscriptions_Cart::cart_contains_subscription() && !is_user_logged_in()) { if (version_compare(WOOCOMMERCE_VERSION, "2.0.0") >= 0) { // WC 2.0+ // Make sure users can sign up if (false === $checkout->enable_signup) { $checkout->enable_signup = true; self::$signup_option_changed = true; } // Make sure users are required to register an account if (true === $checkout->enable_guest_checkout) { $checkout->enable_guest_checkout = false; self::$guest_checkout_option_changed = true; if (!is_user_logged_in()) { $checkout->must_create_account = true; } } } else { // WC 1.x // Make sure users can sign up if ('no' == get_option('woocommerce_enable_signup_and_login_from_checkout')) { update_option('woocommerce_enable_signup_and_login_from_checkout', 'yes'); self::$signup_option_changed = true; } // Make sure users are required to register an account if ('yes' == get_option('woocommerce_enable_guest_checkout')) { update_option('woocommerce_enable_guest_checkout', 'no'); self::$guest_checkout_option_changed = true; } } } }