Search code examples
phpsymfonyyamlcheckoutsylius

Overide checkout process in Sylius


This is my first time working with sylius and i am having a hard time trying to get my hands on any form of information regarding it.

I would like to overide all of the checkout with my custom checkout.

I have tried to overide the routes but it doesnt seem to work.

i added this in my routes.yaml

sylius_checkout_address:
    path: /checkout/address
    methods: [GET, POST]
    defaults:
        _controller: open_marketplace.controller.test_controller::helloWorld

sylius_checkout_select_shipping:
    path: /checkout/select-shipping
    methods: [GET, POST]
    defaults:
        _controller: open_marketplace.controller.test_controller::helloWorld

sylius_checkout_select_payment:
    path: /checkout/select-payment
    methods: [GET, POST]
    defaults:
        _controller: open_marketplace.controller.test_controller::helloWorld

sylius_checkout_complete:
    path: /checkout/complete
    methods: [GET, POST]
    defaults:
        _controller: open_marketplace.controller.test_controller::helloWorld

i am just trying to see if i can even just echo hello world and die().

But i still get the old checkout process.


Solution

  • Overwriting the routes in symfony is always possible.

    The last route counts, so make sure you load the sylius routes first and then add your own route definition.

    The route must be named exactly like the original one. I guess in your case the routes named:

    sylius_shop_checkout_start:
      # ...
    
    sylius_shop_checkout_address:
      # ...
    
    sylius_shop_checkout_select_shipping:
      # ...
    
    sylius_shop_checkout_select_payment:
      # ...
    
    sylius_shop_checkout_complete:
      # ...