Promotion system improvements
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.
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)
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!
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 rule checker allows you to apply promotion to a specific country for shipments. Most obvious use-case is "free shipping to Germany".
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!
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.
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!