How to customize or remove shipping from step engine ?

vikas.k
vikas.k Posts: 9 🧑🏻‍🚀 - Cadet

Hello Everyone I want to remove shipping from checkout step so is there any out of box functionality available in spryker ?

Answers

  • Hidran Arias
    Hidran Arias Senior Technical Trainer Sprykee Posts: 86 🏛 - Council (mod)

    In order to do that, You would have to override the CheckoutPageFactory. Also the StepFactorty.

    In the StepFactory, override the parent method:
    public function getSteps(): array

    {
    
    return [
    
    $this->createEntryStep(),
    
    $this->createCustomerStep(),
    
    $this->createAddressStep(),
    
    // $this->createShipmentStep(),
    
    $this->createPaymentStep(),
    
    $this->createSummaryStep(),
    
    $this->createPlaceOrderStep(),
    
    $this->createSuccessStep(),
    
    $this->createErrorStep(),
    
    ];
    
    }
    

    In the CheckoutFactory, return your own StepFactory implementation:
    <?php

    
    
    namespace Pyz\Yves\CheckoutPage;
    
    
    
    use Pyz\Yves\CheckoutPage\Process\StepFactory;
    
    use SprykerShop\Yves\CheckoutPage\CheckoutPageFactory as SprykerCheckoutPageFactory;
    
    
    
    class CheckoutPageFactory extends SprykerCheckoutPageFactory
    
    {
    
    public function createStepFactory(): StepFactory
    
    {
    
    return new StepFactory();
    
    }
    
    }
    
    You have to also override the CheckoutPageRouteProviderPlugin , override the addRoutes method, copy the parent one and remove the route for the shipment.
    
    After that, You would have to override the templates which refer to the Shipment.
    
    Also the states in your OMS related to Shipment