Redirect customer after registration is successfully completed

Highlighted
New Member
2 0 0

Hi,

I assigned to work on an existing Shopify store theme, and it uses google & facebook SDKs for as authenticating layer (Registration, Login) with `ajax`. It's somehow not redirecting the user after successful registration or login and the {{customer}} is undefined !!. I started to debug it and all is working fine, it gets required data from Google oAuth and Facebook then passes to `/account/` while doing the request.

 

I would really appreciate it if someone helps with this issue.

 

Here is a `customer_login` code snippets:

function loginUser(email, password) {

    var data = {
      'customer[email]': email,
      'customer[password]': password,
      form_type: 'customer_login',
      utf8: '✓'
    };
    
    var promise = $.ajax({
      url: '/account/login',
      type: 'POST',
      method: 'POST',
      data: data,
      dataType: 'html',
      async: true
    });

    if (givit) {
      return promise;
    } else {
      promise.done(function (html) {
        
        if (html.indexOf('Invalid login credentials') == -1 ) {
          
            {% if cart.item_count > 0 %}
              window.location.href = '/collections/subscriptions/products/';
            {% else %}
                window.location.href = '/account/';
              }
            {% endif %}
          }
        } else {
          $('#connect-btn').prop('disabled', false);
          $('#CustomerLoginFormModal .errors').show();
        }
      });
    }
    
  }

 

Thanks in advance,

Ahmed

 

0 Likes
Highlighted
New Member
2 0 0

@HandHugs @RubyJasmin I saw your answers in other discussion would you help me with this? I would really appreciate it  

0 Likes