0

We have a Drupal 7 site using Commerce and Discounts and we need to create a discount that will discount one product in the order by 100%.

Basically, we need to give a coupon discount for ONE free product but so far we only see a way to discount ALL products on the order or the entire order.

We've tried Commerce Discount EXTRA (module) and it gets close by using the "Per Quantity Product Discount" but it forces you to select one specific product that the discount would apply to instead of ANY product.

So, does anyone know of a way to achieve creating a discount to only discount ONE of ANY product in an order?

  • There isn't enough information in the question to properly answer it. It isn't clear, for example, why the general SKU matching condition isn't sufficient here - a 100% product discount on the matching SKU would discount just that one product to $0. However, if you're indicating you should only get 1 of that SKU free regardless of the quantity in the order, that's a different matter. In that case, Buy X Get Y could work fine, but we'd need to know the criteria required to grant the discount to advise on proper configuration. In other words ... the tools are there, but we need more info. – Ryan Szrama Mar 27 at 14:26
  • Hi Ryan, thanks for the reply. Some more information: owner wants to offer a discount code for one free product of any type/SKU/category. So it would be 100% off of any one product. If the user has more than one product in the cart then only one of them is free (highest price preferably). The "Pre-quantity product discount" seems to be closest to what we need but it has unneeded parameters such as "Buy #" (which I suppose may be able to be set to 0) but we don't want to limit the products so "Of any of these off products" is where this offer type fails our needs. – quantumized Mar 27 at 18:54
  • Would the customer get that free product even if they didn't buy anything? So I could literally just add a single product to the cart and checkout for free? – Ryan Szrama Mar 28 at 13:25
  • Yes, that is correct. The customer could get a free product without purchasing anything else (with the use of a coupon code condition). Basically, it's a 'loyalty' program where the owner wants to give out a coupon code to their best customers allowing them to obtain 1 free product of their choice. – quantumized Mar 28 at 14:42
1

With the offer types defined in Commerce Discount / Commerce Discount Extra, there isn't much you can do. The closest ones to what you've described are the per-quantity % off discounts, but as you've discovered, you have to specify either a target product or product category. If you're using a taxonomy configuration that allows the per-quantity category discount (i.e. you have a term reference field on your product display nodes that you can target in the "Products in these offer categories" field), then you can configure this by just identifying every product category in a comma separated list. Otherwise this is going to require custom code.

Since your requirement is also to tie this to a coupon code, you're going to have to write that custom code as a custom offer type. It could be that you simply copy the per-quantiy product discount and change the matching logic to allow discounting any product on the order, but I gotta be honest ... that code is hairy. I wrote the current implementation, and I'm sure it would take even me a full day just to remember what's going on in there and try out some potential solutions.

That said, you could try to "hack" it using existing pieces. Basically ... you could create a new taxonomy vocabulary with a term that identifies products that are eligible for the free product offer. You can then add a term reference to that vocabulary on every product display and select the term for them. You're basically creating a global product category that all of your products are assigned to ... and you can then hide the term from the UI so customers never see it. This may actually be a preferable solution in the future anyways, as the merchant may end up wanting to restrict certain products from these coupons. Give it a go, let us know how it turned out!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.