Show Change Billing And Shipping Address Tab When User Checkout

When user is registered and adds product to cart and when presses Buy Now Button he is taken to the Shipping Options Tab even if the user has not added the address after registration which causes an order creation issue, order gets created without address.

How can we take him to the address page if the data is missing ?

When user is registered and adds product to cart and when presses Buy Now Button he is taken to the Shipping Options Tab even if the user has not added the address after registration which causes an order creation issue, order gets created without address.

How can we take him to the address page if the data is missing ?

You can make some profile fields required for checkout page. In this case 3rd step should not be displayed

You can make some profile fields required for checkout page. In this case 3rd step should not be displayed

Where to do this ?

do u mean by coding or is this some setting ?

If coding please guide which file/function it will be and will have a look

Where to do this ?
do u mean by coding or is this some setting ?

If coding please guide which file/function it will be and will have a look


Check the Administration -> Profile fields page

http://prntscr.com/gfdte2

Yes its already marked Required http://prntscr.com/gfelhgbut it seems it doesnt honor it when the checkout is done.

Yes its already marked Required http://prntscr.com/gfelhgbut it seems it doesnt honor it when the checkout is done.

Hm. If I remember correctly, there was a condition in the code to show 3rd step only if all required fields are filled up

can u tell me where this condition is and i can test the code for validation of the condition ?

can u tell me where this condition is and i can test the code for validation of the condition ?

If I remember correctly, check the app/controllers/frontend/checkout.php

$billing_population = fn_check_profile_fields_population($cart['user_data'], 'B', $profile_fields);
$shipping_population = fn_check_profile_fields_population($cart['user_data'], 'S', $profile_fields);

Had to add this section in step 3 validation to make it work

    if ($edit_step == 'step_three') {
    	$billing_population = fn_check_profile_fields_population($cart['user_data'], 'B', $profile_fields);
		$shipping_population = fn_check_profile_fields_population($cart['user_data'], 'S', $profile_fields);
		if  ($billing_population != true || $shipping_population != true   ){
		 $completed_steps['step_two'] = false;
        }
    }

Also i found one strange piece of code where its checking if the profile fields are empty , shouldnt it check if its not empty rather than empty

      if ($billing_population == true || empty($profile_fields['B'])) {
            // All mandatory Shipping address data exist.
            $shipping_population = fn_check_profile_fields_population($cart['user_data'], 'S', $profile_fields);
            Registry::get('view')->assign('shipping_population', $shipping_population);
        if ($shipping_population == true || empty($profile_fields['S'])) {
            $completed_steps['step_two'] = true;
        }
    }

Also i found one strange piece of code where its checking if the profile fields are empty , shouldnt it check if its not empty rather than empty

      if ($billing_population == true || empty($profile_fields['B'])) {
            // All mandatory Shipping address data exist.
            $shipping_population = fn_check_profile_fields_population($cart['user_data'], 'S', $profile_fields);
            Registry::get('view')->assign('shipping_population', $shipping_population);
        if ($shipping_population == true || empty($profile_fields['S'])) {
            $completed_steps['step_two'] = true;
        }
    }

You are right, strange code. Try to comment out the following line

$completed_steps['step_two'] = true;

You are right, strange code. Try to comment out the following line

$completed_steps['step_two'] = true;

I think this should do fine instead of commenting ( made it non empty in condition )

      if ($billing_population == true || !empty($profile_fields['B'])) {
            // All mandatory Shipping address data exist.
            $shipping_population = fn_check_profile_fields_population($cart['user_data'], 'S', $profile_fields);
            Registry::get('view')->assign('shipping_population', $shipping_population);
        if ($shipping_population == true || !empty($profile_fields['S'])) {
            $completed_steps['step_two'] = true;
        }
    }
I've lost a lot of sales due to this problem and many customers have complained about not being able to register properly.
This is an unforgivable and incomprehensible bug.
I reported this error more than a year ago, without ever having responded.
And for this and other problems I am experiencing, I am moving to another cms.
In the moment I solved the problem by modifying this code:
$billing_population = fn_check_profile_fields_population($cart['user_data'], 'B', $profile_fields);
        Tygh::$app['view']->assign('billing_population', $billing_population);
    if ($billing_population == true || empty($profile_fields['B'])) {
        // All mandatory Shipping address data exist.
        $shipping_population = fn_check_profile_fields_population($cart['user_data'], 'S', $profile_fields);
        Tygh::$app['view']->assign('shipping_population', $shipping_population);

        if ($shipping_population == true || empty($profile_fields['S'])) {
            $completed_steps['step_two'] = true;
        }
    }

in this

$shipping_population = fn_check_profile_fields_population($cart['user_data'], 'S', $profile_fields);
            Tygh::$app['view']->assign('shipping_population', $shipping_population);
        if ($shipping_population == 1) {
            $completed_steps['step_two'] = false;
        }else{
            $completed_steps['step_two'] = true;
        }

and in Administration -> Profile fields page I set e-mails do not show under cechout