Sylius uses API Platform to manage all API endpoints. This lets you configure endpoints using YAML or XML files or PHP class attributes. Here’s how to add, remove, and modify Sylius API endpoints.
How to add an endpoint to the Sylius API?
To add a custom endpoint for the Order resource, create a configuration file in the config/api_platform/ directory.
This configuration defines a new endpoint at /shop/orders/custom-operation that runs CustomCommand when accessed.
Order Modification Restrictions
By default, Sylius API restricts order modifications to the "cart" state. If you need to perform actions on orders outside the cart state, add your custom endpoint to the sylius.api.doctrine_extension.order_shop_user_item.filter_cart.allowed_non_get_operations parameter. This will enable modifications for other order states.
How to remove an endpoint from the Sylius API?
If you don’t need certain endpoints (e.g., for shipping if you only sell digital products), you can disable them.