Facebook login does not work in checkout page.

Solved3 replies2 participantsUpdated by howard

  • Avatar: chihao.weng
    howard
    Participant

    My customer ask me to place a facebook login button in checkout page like in my-account page. Please help on this! It is impossible not to do this for them.

    If the login does not work in checkout page for any reason , is it possible to redirect to cart page?

    3 Answers

    Avatar: chihao.weng
    howard
    Participant

    I tried to use another way to avoid facebook login in checkout page.

    I redirect user to my-account page to login if they not logged in and wanna access cart or checkout page.

    When user login using username and password , the filter wp_login is trigger then redirect them to checkout page.

    However when user use facebook login , the filter wp_login is not trigger so they enter my_account page which is wrong. I want them to redirect to checkout page.
    What filter or action can I use to check if their cart is not empty then redirect them to checkout page after facebook login successfully ?

    function wpse_131562_redirect() {
    if (
    ! is_user_logged_in()
    && (is_cart() || is_checkout())
    ) {
    // feel free to customize the following line to suit your needs
    wp_redirect(‘/my-account’);
    exit;
    }
    }
    add_action(‘template_redirect’, ‘wpse_131562_redirect’);

    function woocommerce_custom_redirects() {
    ob_start();
    if ( WC()->cart->get_cart_contents_count() !== 0 || !WC()->cart->is_empty() ) {
    wp_redirect( “/checkout” );
    exit;
    }

    }
    add_action(‘wp_login’, ‘woocommerce_custom_redirects’);

    Avatar: Rose Tyler
    Rose Tyler
    Support staff

    Hello,

    You can add the next code in functions.php of the child theme:
    add_filter('et_remove_checkout_authorization', function(){return false;}, 10, 1);

    Regards

    Avatar: chihao.weng
    howard
    Participant

    I end up adding a redirect code in /et-core-plugin/app/controllers/authoroize.php

    Line 151 :

    if ( WC()->cart->get_cart_contents_count() !== 0 || !WC()->cart->is_empty() ) {
    				$checkout_page = wc_get_checkout_url();
    				wp_redirect( $checkout_page );
    				exit;
    			}

The issue related to '‘Facebook login does not work in checkout page.’' has been successfully resolved, and the topic is now closed for further responses