Facebook login does not work in checkout page.

This topic has 4 replies, 2 voices, and was last updated 4 years, 3 months ago ago by howard

  • Avatar: chihao.weng
    howard
    Participant
    February 3, 2021 at 09:39

    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
    February 3, 2021 at 11:04

    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
    February 4, 2021 at 13:22

    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
    February 4, 2021 at 19:55

    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;
    			}
  • Viewing 4 results - 1 through 4 (of 4 total)

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

We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.