2 min. read
Categories: News Technical
A simple way to cancel your orders in Sylius
A simple way to cancel your orders in Sylius

Hello everyone! Another week means another official Sylius plugin discussed. Although the customer is now able to reorder a previously placed order and to refund it, there’s still plenty of order-related features that need to be covered. Have you ever placed an order, not paid for it yet and decided to resign from buying at all? If so, the next Sylius plugin seems to be a welcome extension to the e-commerce domain. So, without further ado…  here comes the Customer Order Cancellation Plugin!

Introduction

Don’t get me wrong – every unpaid order could and still can be canceled in Sylius. However, it used to require contacting the shop administrator and discussing details via phone or a bunch of e-mails.

The main desire that stood behind Customer Order Cancellation Plugin development was the improvement of shop user’s experience. The action of canceling the order is not always a proper behavior, however. In spite of the plugin being fully customizable, the default configuration forbids canceling once the order has already been either paid or shipped.

What is Customer Order Cancellation Plugin?

Most importantly, Customer Order Cancellation Plugin is an official Sylius extension developed by the Sylius Core Team. Let’s briefly look at its features:

  • Canceling unpaid and unshipped order
  • Being prevented from cancelling paid but unshipped order
  • Being prevented from cancelling shipped but unpaid order
  • Being prevented from cancelling paid and shipped order

How does it work code-wise?

The plugin itself is based on two mechanisms that are well-known among Sylius contributors:

  • Grids
  • State Machine

A grid configured for customer’s representation of the order defines actions that can be taken, such as ‘Pay’ or ‘Show’. The configuration needed to be extended by action ‘Cancel’ represented by the additional button in order’s Actions section. The button is linked to a route delivered by plugin’s code, and the controller’s responsibility is to apply a proper state machine transition to a given order.

How to get it?

Yes, you have guessed it – the plugin is free. You can see the source code on a public GitHub repository or attach it to your Sylius-Standard-based project using Composer. Let me notice that if you are familiar with Symfony Flex, the plugin’s installation requires just one command to make the magic happen. The only thing left for me to do is to wish you…

 

Happy canceling!

 

Share:
More from our blog
Technical 2 min read 04.12.2024
Here’s everything you had to know about the first major release since 2017! Over 7 years after the first major release, on Nov 12, 2024, we have released Sylius 2.0.0. We had a great opportunity to announce it first at SyliusCon in Lyon, but now, as we are back to… Read More
2 min read 22.11.2024
The emotions start to settle after SyliusCon, and it’s time to reflect on this incredible milestone in our journey. Why a milestone? Because SyliusCon exceeded our expectations in every possible way. We broke attendance records and brought together the key figures of our community, numerous partners, freelancers, and simply all… Read More
Cloud 2 min read 17.06.2024
We are thrilled to announce that we just signed a strategic partnership with Platform.sh, and as a result, we are extending our offer with Sylius Cloud powered by Platform.sh. Platform.sh is a modern Platform-as-a-Service (PaaS) solution that allows businesses to leverage the cloud environment without losing access to the code… Read More
Comments