What are the Slack Archives?

It’s a history of our time together in the Slack Community! There’s a ton of knowledge in here, so feel free to search through the archives for a possible answer to your question.

Because this space is not active, you won’t be able to create a new post or comment here. If you have a question or want to start a discussion about something, head over to our categories and pick one to post in! You can always refer back to a post from Slack Archives if needed; just copy the link to use it as a reference..

I assume there is no way to conditionally _completely disable_ a checkout step?

UKGT7RC7P
UKGT7RC7P Posts: 538 πŸ§‘πŸ»β€πŸš€ - Cadet
edited May 2020 in Help

I assume there is no way to conditionally completely disable a checkout step?

Β«1

Comments

  • UKGT7RC7P
    UKGT7RC7P Posts: 538 πŸ§‘πŸ»β€πŸš€ - Cadet

    i.e. to not redirect to that step at all based on a condition

  • Jeremy Fourna
    Jeremy Fourna Lead Product Manager Posts: 130 πŸ§‘πŸ»β€πŸš€ - Cadet

    I guess there is, since we skip the payment step if the cart is paid by a gift card for example

  • UKGT7RC7P
    UKGT7RC7P Posts: 538 πŸ§‘πŸ»β€πŸš€ - Cadet

    from what I can see the step engine will redirect to each step

  • UKGT7RC7P
    UKGT7RC7P Posts: 538 πŸ§‘πŸ»β€πŸš€ - Cadet

    hmm

  • Jeremy Fourna
    Jeremy Fourna Lead Product Manager Posts: 130 πŸ§‘πŸ»β€πŸš€ - Cadet

    You probably will find how to do it via our Gift card integration guide https://documentation.spryker.com/docs/gift-cards-feature-integration-201907

  • UKGT7RC7P
    UKGT7RC7P Posts: 538 πŸ§‘πŸ»β€πŸš€ - Cadet

    can't see anything about step engine in there?

  • Jeremy Fourna
    Jeremy Fourna Lead Product Manager Posts: 130 πŸ§‘πŸ»β€πŸš€ - Cadet

    @UKBSFUDEJ could you help here?

  • UKGT7RC7P
    UKGT7RC7P Posts: 538 πŸ§‘πŸ»β€πŸš€ - Cadet
    edited May 2020

    but from what I see the step engine needs to redirect to each step - I would guess that the payment step for gift cards is "hit" but then immediately redirects ... maybe

  • Tamas Nyulas
    Tamas Nyulas Application Architect Posts: 20 πŸ§‘πŸ»β€πŸš€ - Cadet

    @UKGT7RC7P is right, we always step in all steps and execute them. Out of the box you can visually skip them only.

  • UKGT7RC7P
    UKGT7RC7P Posts: 538 πŸ§‘πŸ»β€πŸš€ - Cadet
    edited May 2020

    would be a good feature request?

  • UKGT7RC7P
    UKGT7RC7P Posts: 538 πŸ§‘πŸ»β€πŸš€ - Cadet
    edited May 2020

    i guess sometimes disabling / not considering a step is preferable (even for performance reasons)

  • Tamas Nyulas
    Tamas Nyulas Application Architect Posts: 20 πŸ§‘πŸ»β€πŸš€ - Cadet

    Well, somewhere you’ll need to define these business logic when to skip what step and since the steps are constructed in a factory method, you’d need to somehow manipulate what the factory should create for you based on that logic.

  • UKGT7RC7P
    UKGT7RC7P Posts: 538 πŸ§‘πŸ»β€πŸš€ - Cadet
    edited May 2020

    or override the StepEngine and add an interface e.g. CanBeDisabled or similar?

  • UKGT7RC7P
    UKGT7RC7P Posts: 538 πŸ§‘πŸ»β€πŸš€ - Cadet
        public function getCurrentStep(Request $request, AbstractTransfer $dataTransfer)
        {
            foreach ($this->steps as $step) {
                if (!$step->postCondition($dataTransfer) || $request->get('_route') === $step->getStepRoute()) {
                    return $step;
                }
    
                $this->completedSteps[] = $step;
            }
    
            return end($this->completedSteps);
        }
    

    would need to be changed

  • UKGT7RC7P
    UKGT7RC7P Posts: 538 πŸ§‘πŸ»β€πŸš€ - Cadet

    but for now I'm just going to allow the redirect

  • Jeremy Fourna
    Jeremy Fourna Lead Product Manager Posts: 130 πŸ§‘πŸ»β€πŸš€ - Cadet

    Will not make your life easier to have the checkout steps defined as a state machine?

  • UKGT7RC7P
    UKGT7RC7P Posts: 538 πŸ§‘πŸ»β€πŸš€ - Cadet
    edited May 2020

    in general yes πŸ™‚ not necessarily in this specific case

  • UM53ZHLTF
    UM53ZHLTF Posts: 43 πŸ§‘πŸ»β€πŸš€ - Cadet

    Maybe it helps, We do skip Shipment step, as we prefill that in the cart already. This way our tpl redirects to payment from address

  • UM53ZHLTF
    UM53ZHLTF Posts: 43 πŸ§‘πŸ»β€πŸš€ - Cadet

    so PostCondition of ShipmentStep is fullfilled

  • UKGT7RC7P
    UKGT7RC7P Posts: 538 πŸ§‘πŸ»β€πŸš€ - Cadet
    edited May 2020

    yes - that's fine - but the shipment step will still be redirected to, and it has to call the step engine to decide if it should redirect or not - so it's not really "disabled"

  • Jeremy Fourna
    Jeremy Fourna Lead Product Manager Posts: 130 πŸ§‘πŸ»β€πŸš€ - Cadet

    To not lost your requirements or problems please create a dedicated idea in our portal https://spryker.ideas.aha.io/ideas

  • UM53ZHLTF
    UM53ZHLTF Posts: 43 πŸ§‘πŸ»β€πŸš€ - Cadet

    I don't think so, if you directly call checkout/payment

  • UKGT7RC7P
    UKGT7RC7P Posts: 538 πŸ§‘πŸ»β€πŸš€ - Cadet

    in that case yes - but if you hit a previous step it will go through shipment

  • UM53ZHLTF
    UM53ZHLTF Posts: 43 πŸ§‘πŸ»β€πŸš€ - Cadet

    hmm true

  • UKGT7RC7P
    UKGT7RC7P Posts: 538 πŸ§‘πŸ»β€πŸš€ - Cadet

    @jeremy.fourna is changing the step engine to a state machine a thing?

  • UKGT7RC7P
    UKGT7RC7P Posts: 538 πŸ§‘πŸ»β€πŸš€ - Cadet

    would be very nice to have a graph in some cases

  • Jeremy Fourna
    Jeremy Fourna Lead Product Manager Posts: 130 πŸ§‘πŸ»β€πŸš€ - Cadet

    it is something that I have in the back of my mind to allow different checkout process depending on your cart or just to have different process per store or mobile vs desktop

  • UKGT7RC7P
    UKGT7RC7P Posts: 538 πŸ§‘πŸ»β€πŸš€ - Cadet

    would be awesome πŸ‘

  • Jeremy Fourna
    Jeremy Fourna Lead Product Manager Posts: 130 πŸ§‘πŸ»β€πŸš€ - Cadet

    then create the idea for it, maybe if it get a lot of votes from the community you will get it soon lol

  • UM53ZHLTF
    UM53ZHLTF Posts: 43 πŸ§‘πŸ»β€πŸš€ - Cadet

    Up for it too πŸ‘