I'm trying to figure out how to set discounts that don't require the customer to enter an offer code (I'm not talking about regular on sale-discounts). Examples of this would be offers such as "order above amount X, receive item Y for free", or "buy X products, receive 1 for free". Ideally the free item(s) would be automatically added to the cart on the basket page if the constraints are satisfied.
AFAIK there isn't any out-of-the-box support for this, as the built-in coupon offer provider requires an offer code. I've tried implementing a custom offer provider, that works very much in the same way, except that it doesn't require an offer code - that way I can leverage the built-in offer constraints and rewards.
The problem is that for this to work, all the backoffice views must be located in the Merchello folder, which doesn't really sit right with me. It also feels a bit redundant to implement an entire offer provider that's an exact copy of the coupon offer provider apart from not requiring an offer code.
Has anyone found a good way to work with general discount offers that don't require offer codes?
I've implemented a similar requirement, whilst it does require a discount code it doesn't require the user to enter it and so it is applied by the checkout process if the conditions are satisfied.
My solution is pretty simple and as follows:
// If the customer has multiple items in the basket we need to apply the 50% shipping discount code
if (this.Basket.Items.Where(x => x.LineItemType == LineItemType.Product).Sum(x => x.Quantity) > 1)
{
checkoutMgr.Offer.RedeemCouponOffer("SHIP50");
}
I hate the fact that the coupon code is hard coded here but as usual no time and no budget for much else although it could be moved into a config somewhere to at least make it a bit more flexible. Ideally, in the future, I might be able to look at refactoring this to either iterate over available offers and check the conditions against the basket contents or allow the user to configure which codes should be applied automatically and iterate over the list checking the conditions as I go and applying where appropriate.
I've been thinking about implementing something similar to what you're suggesting (I've dropped the notion of implementing my own discount offer provider).
The idea is basically that we use the built-in coupon offer provider, but all offer codes that begin with a certain prefix will be automatically applied, provided that the configured constraints are satisfied. This could be achieved through a custom CheckoutManagerInvoiceCreate task for example.
I've dropped the notion of implementing my own discount offer provider
I'm not so sure it necessary to go to that extent anyway and might be a largely wasted effort given that you will most likely want to use the majority of the existing functionality with just "some" customisation.
The solution I posted works for me right now but I would be interested to hear an update on the route you decide to take when you get there.
Exactly, that's why I gave up on that thought... although that would've been the most flexible/extensible approach had I needed more customization.
What I ended up doing was to create a custom CouponFreeItemReward to which a free item can be bound. I then added a custom AddFreeItemsToInvoiceTask to the CheckoutManagerInvoiceCreate task chain that adds all offers that begin with a certain prefix (offers with this prefix are treated as "free item offers") and attempts to award them.
I'm thinking that the same strategy can be used for other types of offers as well, such as buy X products, receive Y for free. This way we can keep things modularized and loosely coupled. The only downside I can think of is that we need a new prefix for each distinct type of offer.
Discounts without offer code
Hi,
I'm trying to figure out how to set discounts that don't require the customer to enter an offer code (I'm not talking about regular on sale-discounts). Examples of this would be offers such as "order above amount X, receive item Y for free", or "buy X products, receive 1 for free". Ideally the free item(s) would be automatically added to the cart on the basket page if the constraints are satisfied.
AFAIK there isn't any out-of-the-box support for this, as the built-in coupon offer provider requires an offer code. I've tried implementing a custom offer provider, that works very much in the same way, except that it doesn't require an offer code - that way I can leverage the built-in offer constraints and rewards.
The problem is that for this to work, all the backoffice views must be located in the Merchello folder, which doesn't really sit right with me. It also feels a bit redundant to implement an entire offer provider that's an exact copy of the coupon offer provider apart from not requiring an offer code.
Has anyone found a good way to work with general discount offers that don't require offer codes?
I've implemented a similar requirement, whilst it does require a discount code it doesn't require the user to enter it and so it is applied by the checkout process if the conditions are satisfied.
My solution is pretty simple and as follows:
I hate the fact that the coupon code is hard coded here but as usual no time and no budget for much else although it could be moved into a config somewhere to at least make it a bit more flexible. Ideally, in the future, I might be able to look at refactoring this to either iterate over available offers and check the conditions against the basket contents or allow the user to configure which codes should be applied automatically and iterate over the list checking the conditions as I go and applying where appropriate.
Not sure if that helps at all?
Cheers, Simon
Hey Simon,
Thanks for the input.
I've been thinking about implementing something similar to what you're suggesting (I've dropped the notion of implementing my own discount offer provider).
The idea is basically that we use the built-in coupon offer provider, but all offer codes that begin with a certain prefix will be automatically applied, provided that the configured constraints are satisfied. This could be achieved through a custom CheckoutManagerInvoiceCreate task for example.
I'm not so sure it necessary to go to that extent anyway and might be a largely wasted effort given that you will most likely want to use the majority of the existing functionality with just "some" customisation.
The solution I posted works for me right now but I would be interested to hear an update on the route you decide to take when you get there.
Cheers, Simon
Exactly, that's why I gave up on that thought... although that would've been the most flexible/extensible approach had I needed more customization.
What I ended up doing was to create a custom CouponFreeItemReward to which a free item can be bound. I then added a custom AddFreeItemsToInvoiceTask to the CheckoutManagerInvoiceCreate task chain that adds all offers that begin with a certain prefix (offers with this prefix are treated as "free item offers") and attempts to award them.
I'm thinking that the same strategy can be used for other types of offers as well, such as buy X products, receive Y for free. This way we can keep things modularized and loosely coupled. The only downside I can think of is that we need a new prefix for each distinct type of offer.
is working on a reply...