3 min. read
Categories:
Promotion system improvements
Our promotions have just become more powerful thanks to several new rules and actions.
Promotion system improvements

Hey folks!

Here is a very quick update about our promotions system, which received some love in the recent weeks. I hope it will save you some work in your Sylius powered projects.

Overview

Every Sylius promotion consists of a set of rules and actions. It can use coupons, but it is an optional feature.
During the checkout process, we check if users order fulfills all the requirements of every active promotion. If it does, we execute the actions.

If the promotion is coupon based, the Order has to reference a valid coupon AND match all the defined rules.

The promotions can also be restricted to specific time frame and have usage limit. (per promotion, and per coupon)

Reverting mechanism

Thanks to the work of Alexandre Bacco we introduced revert() method to the PromotionActionInterface. (See the PR)

This new method is responsible for “reverting” its effects on the promotion subject.
This is very useful for more complex actions, where you need to perform some specific operations on a subject, which is no longer eligible for given promotion.

Add product action

With the reverting system, Alexandre implemented new add product action, which allows you to add a specific product (or variant) to the users cart.
You can specify the unit price (0 if free) & quantity. There are a lot of use-cases. With a combination of the new rules, you could create very interesting setups…

  • Free product for all orders above X total value.
  • Additional free product to all orders with more than Y items & containing a T-Shirt. (or another taxon)
  • Discounted product for 2nd order of every user.
  • 3 Free products for first 5 orders on a specific day.
  • And 34234 other combinations… (Yes, this number is an estimation)

Additionally, our great Sasa Stamenkovic implemented several other actions and rules.

Shipping discount action

With this action you can apply specific % discount for the shipping of an order.
Just like for the first new action, the possibilities are huge. Simplest use case is free shipping for orders above X amount or for specific group of products.

User nth order rule

This brand new rule checker allows you to apply promotions for a specific user purchase. Need free shipping for the 5th order? You can do this now!

User loyalty

This allows you to check if user has been with you for a specific period of time – more than a month, year or whatever you like. Really useful!

Shipping country

Shipping country rule checker allows you to apply promotion to a specific country for shipments. Most obvious use-case is “free shipping to Germany”.

Taxonomy

Sylius uses a very nice taxonomies engine to classify the products. You can create several taxonomies (like Category, Brand, Manufacturer, Special or You-name-it) and from now on you can apply promotion to specific items.
For example, free shipping & 10% discount for orders containing an item, which is categorized as “Christmas Special”… Again, the combinations are endless.

More is coming

Yes, we want to include more checkers and actions in the future, like customer group rule or currency requirement.
The best part about promotions is that you can very easily create your own custom rules/actions, by implementing one simple service & single configuration form.

You could implement pretty much everything, like a promotion, which schedules an e-mail, two weeks after the purchase with a 10% discount coupon for all users that are in the Retail group and have already purchased a T-Shirt from a specific brand.

If you have an idea or a feature request with a specific scenario, let us know in comments section below!

Stability

While all these features are covered with Behat scenarios, we plan to add even more edge-case stories. Please remember that Sylius is not stable yet and some glitches might occur.

What’s next?

According to the roadmap published few months ago, we should be in the BETA already, but… we’ve made some changes & improvements to these plans. That is the nature of an open source projects roadmap.
We have a lot of amazing stuff coming (new, responsive frontend theme), stay tuned!

Tags:
Share:
Paweł Jędrzejewski
Self-taught developer and entrepreneur, who has built an entire career and business through Open Source technology. Speaker at international conferences. PHPers meetups co-organizer. Keen on helping other young entrepreneurs and companies who may want to follow a similar path.
More from our blog
Technical 3 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
3 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 3 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