4
Answers
Vote up!
3
Vote down!

How to get a discount to consider total quantity of all line items?

I'm trying to use the "Simple Discount using the VAT Hack" (http://www.drupalcommerce.org/node/461) to provide a discount on the purchase of 12 or more items.

This is working great as long as there is one product type in the cart that meets the 12+ quantity condition. But, if I have two different products and have the combined quantity of both products meet the criteria (for example 5 of one product and 7 of another), the discount does not show up.

How do I make it so that the discount considers the combined cart quantity of products, not just a single product or line item? What condition do I need to set to make this happen?

Thank you,
Joe

Asked by: pkchoo
on May 31, 2012

4 Answers

Vote up!
3
Vote down!

Instead of checking the product line item's quantity directly (i.e. using a Data comparison condition on the commerce-line-item:quantity property), you should use the Total product quantity comparison condition provided by the Commerce Order module.

Ryan Szrama
Answer by: Ryan Szrama
Posted: May 31, 2012

Comments

Ryan, Thank you for getting back to me so quickly on this... I love the new site design and this Q&A section is such a great resource!

I attempted what you suggested, using the "Total product quantity comparison" condition. The only data selector that I could get to work was "commerce-line-item:order", but it still does not consider the combined total quantity of two different line items (Product A - 11 items and Product B - 1 item, where the combined total should trigger the condition greater than 11). Basically, no discount is applied in this scenario. When I increase Product A to 12, the discount shows up. The condition has the operator at ">=" and the "quantity" = 11. It appears to only trigger when one product or line item satisfies the condition...

I attempted to choose other data selectors, but I get this type of error message: "Data selector commerce-line-item:commerce-total: for parameter commerce_order is invalid."

- pkchoo on May 31, 2012

I'm sorry if I post this comment twice, my first one disappeared.

Thanks for getting back to me so quickly. The site looks great and this Q&A is such a great resource!

I attempted to use the "Total product quantity comparison" condition and used the "commerce-line-item:order" as the data selector (it's the only selector that I could get to work, the other gave me errors), but it still did not provide a discount in this scenario. (Product A - 11 items and Product B - 1 item, where discount should apply on orders of 12 items or more).

When I increase Product A to 12, the discount shows up. When I flip flop it and increase the other product to 12, the discount shows up, but in any scenario, when either product does not meet the condition's value (operator ">", quantity "11"), no discount is provided.

Any idea what I'm doing wrong?

Thank you,
Joe

- pkchoo on May 31, 2012
Vote up!
0
Vote down!

Well ... I have been trying to get a simple discount operating. All orders over $200 get a 10% discount. Shouldn't be too hard!

I can set up a pricing rule that gives customers a 10% discount on items of more than $200 value. that's not a problem. But trying to get a rule that gives a discount on orders that have a total of more than $200 is proving impossible.

One of the frustrations is that when I select a condition - like 'Order balance payment' and I choose one of the selectors offered 'site:current-cart-order:commerce-order-total:' enter the variables and save, it comes up with 'Data selector site:current-cart-order:commerce-order-total: for parameter commerce_order is invalid.' Which raises the question 'Why offer the option if it's invalid anyway?'

I have gone thru a number of the options available and they all come up with the same result.

Which leaves me with a request and a suggestion.

Request: Can anyone point me in the right direction for solving this riddle?

Suggestion to Ryan and the Drupal Commerce team: Please de-geekify this! This is such a good program that is quite spoiled by being too geeky. This is not being negative or smart about geeks. It's just that I am not a geek. I am a businessman trying to run a business, not a geek trying to solve geek problems. So much of my time is being taken trying to solve geek problems that are barely comprehensible to me that I am not paying proper attention to the business problems that I should be paying attention to. Discounts are a normal part of business and should be easily accessible to business owners without having to spend - literally - days trying to work out how to set them up!

Thanks

Willem

Answer by: willem
Posted: Jan 16, 2013
Vote up!
0
Vote down!

Hello.

I, similarly to willem, am trying to set up a fee (instead of a discount) to be applied to orders between x and y amounts. I haven't been able to find a valid data selector for "order subtotal." I went hunting and found commerce-line-items-total in the .module file of commerce - is there something like this I can use? It doesn't look as though I will be able to write rules using loops of line item prices to accomplish my goal either. I guess I'm rather stumped, and would appreciate any suggestions.

Thank you,
Sara

Answer by: svouthi
Posted: Jul 23, 2013

Comments

I found a solution for my scenario. There is a module - Commerce Price by Component, which adds the token commerce-order:commerce-order-total:base-price:amount, which gives the total of all order items' base prices (effectively the subtotal in my use case.) Hopefully that helps someone else also.

- svouthi on July 25, 2013
Vote up!
-1
Vote down!

Is it possible to integrate drupal commerce as a page on specific directory like
this
i want to use drupal commerce on that url.Not in main URL

Answer by: Anonymous (not verified)
Posted: Jul 22, 2012