Jump to content

How to SKIP address step during checkout


lcsh

Recommended Posts

Hello,

Im searching a way to skip the address step during the checkout.
I've found some topic that talked about removing it completely, but i just want to SKIP it. 

Like it's already the case with the first step "personnal data", when the user is connected, this step is skipped automatically
( skipped mean here the tab is -complete and closed, with a button "edit" if needed. )

I want to do the same with the address step, because if he is already connected, i already have his address.
And he can edit it from the last step, if he want to correct it.

Somebody already done that on a PS 1.7 who can help me ?
or somebody who understand how the first step is skipped, and from there maybe i can craft something..

Edited by lcsh (see edit history)
Link to comment
Share on other sites

Hi.

For Prestashop 1.7

./classes/checkout/CheckoutAddressesStep.php

1. find function handleRequest

2. almost finally add functions

$this->logged_in = $this
            ->getCheckoutProcess()
            ->getCheckoutSession()
            ->customerHasLoggedIn();

if ($this->logged_in && !$this->getCheckoutSession()->getCustomer()->is_guest) {
            $this->setComplete(true);
}

3. result:

obrazek.thumb.png.3b400c4fcbf5350d8ec6fb62799799de.png

Edited by ps8moduly.cz (see edit history)
Link to comment
Share on other sites

Thank you for your answer ! 🤩
 

It work only when it is the second time i'm coming on a cart. The first time i see a new cart it go to address step. 

I dont see any particular error in the console. 

Do u have tested it ? maybe it come from my site, it is a bit customized and wobbly sometimes. Im on 1.7.8.9 btw.

 

Link to comment
Share on other sites

  • 2 weeks later...

@ps8moduly.cz Thank you for your help ! 

Can you please help me with this last step ?

On 7/14/2023 at 9:02 AM, lcsh said:

Thank you for your answer ! 🤩
 

It work only when it is the second time i'm coming on a cart. The first time i see a new cart it go to address step. 

I dont see any particular error in the console. 

Do u have tested it ? maybe it come from my site, it is a bit customized and wobbly sometimes. Im on 1.7.8.9 btw.

 

 

Link to comment
Share on other sites

  • 3 weeks later...

I lied, it doesn't work, sorry for the spam.

So if somebody (a real person) could help, it would be really appreciated.

 

Ok, Thanks to ChatGPT (yeah its real), i've found a solution.

After discussing with him about the ps8moduly.cz 's code, and after he tell me that i should do it with override(i know), he tell me that the main reason for this error should be "Session Initialization : the session might not be fully initialized or updated during the very first visit to a new cart. This could potentially affect the behavior of the code". 

So i asked him how to repair that. 
He tell me to add this below code before the ps8moduly.cz 's code : 
   // Make sure the session is started and initialized
            if (session_status() !== PHP_SESSION_ACTIVE) {
                session_start();
            }

And it work. (I'm still testing every checkout process, but i've seen no problem for now.)
So thanks to ChatGPT and @ps8moduly.cz, this thread is [SOLVED], thanks !

Edited by lcsh
i lied (see edit history)
Link to comment
Share on other sites

  • lcsh changed the title to How to SKIP address step during checkout

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...