Rules? Commerce Stock? How to set up quantity based discounts in drupal commerce?
Hello,
I need to set up price discounts according to the quantity of a product ordered.
For instance quantity 1 (product A) $50.00
For instance quantity 2-4 (product A) $30.00
For instance quantity 5-9 (product A) $25.00
For instance quantity 1 (product B) $20.00
For instance quantity 2-4 (product B) $15.00
For instance quantity 5-9 (product B) $12.50
Having a look at Randy's complex pricing rules video. It did not look like rules has quantity based reference or am I wrong? I really hope I am wrong?
Does the Drupal Stock module come into the picture for this, if so, how?
I must not be the only one needing this functionality. This is a common e-commerce need I would think?
Note: All Randy's useful Drupal Commerce Vidoe's can be found here for those that want to learn from them http://vimeo.com/user5912539/videos/sort:date
Comments
Commerce Price Table - Quantity Pricing
Commercestudy
You might check out Commerce Price Table in the Contrib section.. Might be a starting point.
John McCormick / NEAR DARK
Thankyou John
Thankyou John, for pointing the Commerce price table module out to me. Looks like it would be ideal for quantity based pricing per item.
Unfortunately after testing have got Notice: Undefined index: error when adding to cart and dollars for the price have change to cents (As in $30 has become 3 cents). However the module is still in development not at alpha or beta stage yet. I guess I will talk to pcambra over in bug reports on the project.
Fixed
Actually it looks like I was the problem not the module. Have gone over the 'price table' field I made in the product type and realised that you should set it to unlimited for multiple price ranges then in your product you can add all your price ranges correctly. filed for the
I need rules after all. Can someone share rules know how?
After contacting pcambra from the commerce price tables project, he told me having quantity discounts on different products mixed together is beyond the scope of the modules capabilities.
pcambra recommended using rules checking quantity and product "family"
since my rules knowledge is very low even though I am trying to learn rules via rfays and nodeone's videos so pcambras advice would probably make perfect sense to the rules knowledgeable but not me at my level.
Is their anyone who has done quantity based product discounts that allows discounts at different price points (like http://drupal.org/project/commerce_price_table) But also allows different products to be added together for discount, not just quantity discounts so long as it is the same product with same sku etc.
If anyone has done this, can you please share it with us?
Thanks from Josh
Update Commerce Extra Rules Project. Find it Here!
Just so everyone knows, Prince Manfred has made a conditions module, that do quantity discounts even across different products and would highly recommend using this as the solution. Since this thread has become so long. I am re-putting it up the top of the page here. It is called Commerce Extra rules. Which means you can target quantity discounts in via taxonomy terms just the way you wanted, by adding the custom condition. many thanks to Prince Manfred for the brilliant effort. Find it below:
Just updated URL to now, proper project page (Late October 2011)
http://drupal.org/project/commerce_conditions
I'm seeking the exact same.
I'm in the same boat. I'm putting together a Commerce site that sells labels of various types (e.g. tie-on, stick-on etc.).
The site is requiring bulk discounts by product types in the same manner as "commercestudy" describes.
I looked at the Commerce Price Table module, but it didn't suit my needs as it offered bulk discount by individual product items, rather than product typs.
I'll watch this thread and see if someone out there can advise.
Hoping to make a start at least. But have hit road block
Ok, I am going to show what I am trying before I hit my road block. Hopefully someone who knows what they are doing with rules and commerce will show us the light.
What got me enthusiastic to start is that add pricing rule also has an input for taxonomy terms hopefully the pricing rule will only be available for the taxonomy term I put in the input. Unless I do not know hat I am talking about of course.
I think we should start by going too:
Home » Administration » Store » Configuration » Product pricing rules
Then we want to add our first pricing rule. I will call it twenty five dollars and it will be for 5-9 items (Have no idea how I am going to target a quantity range though)
Then hurrah, there is an input underneath where we can put in a taxonomy tag, so we do not have target a product type anymore, unless that is not what it is for.
Then after saving we go to the next page and go down to actions and add an action. Then we choose subtract an amount from the unit price from the select box. Wait for the ajax to load, then leave the data selector as commerce_line_item??? Then Specify a numeric amount to subtract from the price and put it in the select box (lets say 15.00 for $15.00?). Then Price component type under that change the select box to discount and save.
Now we are thrown back too:
Home » Administration » Store » Configuration » Product pricing rules
Then we go under the heading that says conditions and choose the add condition link. Then under the Select the condition to add heading choose from the drop down (Because it looks like the only option mentioning quantity???) Total product quantity comparision, then the ajax will move you to more stuff to fill out that looks like rocket science to me, the only thing that I can understand is the meaning of the data selectors.
If someone can show us how to make a quantity range in add new condition then we may be set, unless I have got everything totally wrong of course. Then all we would need to do is put a taxonomy tag that matches our pricing rule into the prices we want to be able to cross discount and then repeat the whole procedure again for every price quantity range/price change and we are done, in my imaginary little world.
Thoughts from someone without clue.
Can a commerce rules expert have mercy on us?
Please : )
Look, I tried : )
Discount for Quantity Range
I haven't tested this so I could be wrong, but concerning how to discount on different quantities of products, I think you can just do a Data Comparison on Line Item > Quantity and test for above a certain number and below a certain number.
See my screen cap, where I've discounted of $3.00 (300 cents, I think the discounts need to be in cents, err, thousandths) for a product with a quantity of 5-10 items.
John / NEAR DARK
Thanks John for the input and screenshot
Thanks John, I realise what you did was untested but was helpful in some ways.
Adding the conditions of the two data comparisons did what it was supposed too. With greater than and the other data comparison for less than, I ended up putting greater than or equal to >= and less than or equal to <= which did the trick for that part of the setup. And a few of things a little different but generally the same. Also the price amount in cents was the way to go, thanks.
A big problem, taxonomy term targeting!! (All are most welcome to add suggestions, even if they are just conceptual):
I was 'hoping' that entering a taxonomy term when adding a pricing rule, would make that pricing rule only available for that taxonomy terms/terms entered when adding the rule. This did not happen. Discounts ended up being attached to any and every product added to cart with matching taxonomy term or not (Note: The discount gets added at checkout by the way).
I hope the community can benefit from the instructions below. I still need help though with taxonomy term targeting of products.
I'm not coming up with
I'm not coming up with anything at first glance for using taxonomy, but you could have a separate product type for products that qualify for bulk discounts. Then just do a data compare that commerce-line-item:type = bulk_product or w/e you name your type. You might end up with a lot of product types depending on how diverse the rules are for your products, but it's an idea.
ORRRR....If you enable the
ORRRR....If you enable the PHP filter module you could execute some code that loads the product by using the product id in the provided line item object (it might be the sku instead of id but either works). Then just compare the taxonomy field on the product with what you're looking for and return true if it's a match.
Prince Manfred, Thanks, Targeting Via Product Type is Excellent
Thanks Prince Manfred,
Targeting via product type is fine (Not just fine, but really good). My problems would be solved as will jkvank's.
I followed your instructions up until:
commerce-line-item:type = bulk_product or w/e you name your type
where I did not know what to input for the product type,
I tried inputting just the machine name of the product type. Got integrity check error
Also tried inputting commerce-line-item:product type machine name here
Also I got an integrity check error?
Screenshot attached.
Uh oh. My bad guys. I
Uh oh. My bad guys. I misunderstood how the line-item type worked. That idea is out BUT I did a little digging in to writing a module for a custom condition. It shouldn't be too terribly difficult to write one that will do the checking like I suggested with the PHP rule, but presents you with any easy field to enter the term you want to check for so you don't have to actually touch the code. I'm crazy busy this week, but if I get a chance I'll try to work something up.
Excellent
Sounds really good : )
When you get time. Please write the the module, will be very useful, just what we need.
A note on the instructions I put in my last post.
Whoops (I posted this comment not knowing that Prince Manfred) had already posted the comments above, the content of this post is still valid. It is just not in reply to Prince Manfred who looks like he has an idea (or two) to target products. Thankyou : )
Back to my notes for when going over the screenshot instructions I attached previously:
1. Discount. The discount will be for each item individually. But every product in the quantity range will get the discount, so specify your calculation for each product as an individual. Look at the Gif's I have attached for step by step screenshot instructions.
2. We should be able to make as many quantity ranges as we want now. 2-5 6-10 or 500-1500 or what ever, just repeat the process as I have specified in the screenshots also thanks to John for his input.
3. We are just missing one vital ingredient in our quantity based discounts. That is how to only target products that have a taxonomy tag?
This is the mystery. To me at least anyhow.
Once someone sorts the taxonomy part out. We are in properly targeted quantity range bliss.
Quantity based discounting
Well thanks to this thread, I think 've got this working.
Using commercestudy's post on Wed, 09/21/2011 - 10:16, I too created a discount rule which was not targetting particular taxonomies.
I tried to use PHP Filters but with no luck.
What I have done is added a Data to compare condition where the selected data is "commerce-line-item:line-item-label", the comparison operator is "contains", and the data value is the first two letters of my SKU.
Fortunately I've been using patterns for my SKU that relates to the taxonomies, (e.g. tie-on labels are PT-xxx, stick-on are PS-xxx etc).
So having a condition of "contains PS" targets only the stick-on product.
cheers all for the assistance.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Update: :( nope, doesn't work as expected. What this does is checks the total quantity of ALL items in the cart against the quantity range, and conditionally applies the discount against the selected taxonomy.
What I'm after is:
for a given taxonomy, if the quantity of orders in the cart are within a range, apply a discount against each of the line items.
So it seems to me that the challenge isn't to apply the discount against a given taxonomy, rather it is how to have the "Total product quantity comparison" calculate the order quantity total for a given taxonomy.
What I have now is this:
Order contains:
2 X Tie-on A @ 15c ea
1 X Stick-On B @ 20c ea
5 x Tie-on C @ 10 c ea
I have a rule that says if Total Tie-Ons in an order is >=3 and <= 10 then subtract 1c from each Tie-on
After the checkout, I successfully see the 1c discount only applied to items A & C, with the nice Discount line.
But unfortunately, if I up the order quantities for item C, i.e.
Order contains:
2 X Tie-on A @ 15c ea
5 X Stick-On B @ 20c ea
5 x Tie-on C @ 10 c ea
The rule doesn't trigger because the total items in the order is > 10.
Almost there I hope.
What we need is a condition
What we need is a condition that can count the quantity of products for a given taxonomy. I've got a rudimentary custom condition for selecting products by taxonomy for applying the discount. It should be pretty easy to adapt it for counting up the quantity. I'll clean them up and post a few test plug ins for feedback tomorrow evening.
Excellent!
Excellent! Thankyou Prince Manfred,
I look forward to testing : )
Line Item Taxonomy Check
Here is a piece of the solution for y'all to try out. After installing and enabling the module go to your rule for bulk product discounts. Add a condition. Under 'Commerce Line Item' there should now be the option 'Line item product has term'. If it's not there, clear your cache and look again. For Commerce Line Item use the data selector 'commerce-line-item'. For Term Reference Field use the machine name of the term reference field on the products being checked (ex. field_sweet_terms). The Term ID value should be the id associated with the term you're checking for. I'm eventually going to have a dropdown list of all the terms but entering the term id manually was a quicker way to get something useful out.
I'll start working on a condition what figures the total quantity of products with a term next. That should be the last piece for this to work properly (EDIT: if you need to offer bulk discounts based on quantities of multiple products instead of just one).
Let me know if there is anything not working or if you notice anything that I did poorly in the code.
Prince Manfred's module
Thanks for this.
I've had a quick try of the module, unfortunately I'm unable to get the condition to trigger.
I've enclosed a couple of screenshots showing the product display, where the Term reference field for the Product type is called field_catalog_category, and a screenshot showing the parameters for the condition in the product rule. (Note that my "Tie-on" taxonomy is term id 1).
I'll have another play with it tonight.
Thanks for this !
I just wanted to confirm that
I just wanted to confirm that you applied the "Tie-on" term to the specific products in addition to adding the field to the product type. Note where I've checked the "Bulk" term in the attached screenshot.
__EDIT:__
I just realized you had your term reference field on the product display. This module expects the term reference field to be on the actual products. For that go to admin/commerce/products/types and add the field to the product type you use. Then go to admin/commerce/products and edit a product so you can select the proper term.
Prince manfred's script
Aaaahhhh, I see. I was using the Taxonomy field associated with the product display node.
My Product definition doesn't have a field that I was testing against.
I've enclosed the structure of my Tie-on product.
Note that my product model was built by following the "Building a Drupal Commerce product catalog" video by Ryan Szrama.
Looks like I'll need an additional attribute/field on the product.
You've got it. Just add a
You've got it. Just add a term reference field right there and select the vocabulary that has your tie-on term. Then go to each of your tie-on products, edit them, and select the tie-on term.
Here is a new version of the
Here is a new version of the module that adds an additional condition for comparing the quantity of all products in an order that have a specified term. It's under the Commerce Order heading and called "Term-based product quantity comparison"
Clear your cache after you update if you've installed the older one. There is a proper way to go about updating modules I think but clearing the cache should work fine for this one.
The code needs some cleaning up and some commenting. From my limited testing it works, though. I should probably create a project page for this so we don't flood the forums with updates. I'll post a link once I've set one up and keep future updates listed there.
Cheers
Thanks... and Use a sandbox!
Thanks for the contributions! You'll be a lot better using a sandbox for these things than attaching zipfiles. Nobody will know in 3 months what this zipfile was or where it came from, but if you [put it in a sandbox](http://drupal.org/node/1068950) it will be obvious. And it will have an issue queue...
I was setting one up as you
I was setting one up as you were typing this I think. You're right, this is a terrible place to actually do the development.
Thanks
Hmmmmmm......
So here's what I've done.
1. On the Product type "Tie-On", added a new field called Bulk, called it field_bulk, made it a term_reference to the Taxonomy term
2. On one of the Tie-On products, added the Taxonomy Term in the new "Bulk" field.
3. Added the rule as per the "Line item product has term" module.
Then bam !
A whole load of errors when I check out:
Notice: Trying to get property of non-object in commerce_extra_rules_conditions_rules_condition_has_term() (line 40 of.... commerce_extra_rules_conditions.module).
Thanks for the feedback. It's
Thanks for the feedback. It's much easier to find errors when the code is out in the wild. Based on the error, I'm thinking your setup is still not quite right.
If you edit the field_bulk field and look at the Field Settings tab is it set to the vocabulary that term id 1 is located in? Go to the Widget Type tab and change it to Check boxes/radio buttons too. That will make it easier to select preexisting terms so you can verify the term id instead of accidentally creating a new term with the auto-complete box.
Let me know how it goes.
It must be something I'm
It must be something I'm doing...
Setting the field to Check boxes/radio buttons I can see the options as per the screenshot enclosed.
I think the problem is how I'm filling in the Term Reference Field in the "Line item product has term"
If I enter field_bulk it spits out errors. If I enter [field_bulk] it ignores the condition.
As you said, I don't want to fill up the Forums, so I'll just see where this module goes.
Thanks heaps so far !
I'm certain it's something
I'm certain it's something I'm doing, so perhaps a step-by-step of what you've done Prince, may assist.
http://drupal.org/sandbox/Pri
http://drupal.org/sandbox/PrinceManfred/1291758
There is the sandbox project. Let's open up an issue there and see what we come up with.
Prince Manfred. Thankyou : )
Prince Manfred, you are a Legend Mate : )
Works like clockwork!
For those having trouble.
I have attached a screenshot.
Follow the arrows and enjoy success : )
Man!
Cool : )
Totalling products in an order that have a specific term.
Now that we are able to target the discount (thanks to Prince Manfred's code), has anyone had success with the second part, i.e. totalling the specific taxonomies in the cart.
"commercestudy", I notice in your screenshot that you are still using the "Total Quantity Product Comparison", and not the "Term-base Product Quantity Comparison".
This last part doesn't seem to work for me.
Hi jkvank, hope things are going well
Hi jkvank,
For me it works perfectly
I simply did exactly as I did in the instructions below
Submitted by commercestudy on Thu, 09/22/2011 - 15:50. Where I had attached the first four screenshots some posts back.
Then followed the instructions that Prince Manfred left for his module.
Submitted by Prince Manfred on Tue, 09/27/2011 - 04:56.
Line Item Taxonomy Check
Here is a piece of the solution for y'all to try out. After installing and enabling the module go to your rule for bulk product discounts. Add a condition. Under 'Commerce Line Item' there should now be the option 'Line item product has term'. If it's not there, clear your cache and look again. For Commerce Line Item use the data selector 'commerce-line-item'. For Term Reference Field use the machine name of the term reference field on the products being checked (ex. field_sweet_terms). The Term ID value should be the id associated with the term you're checking for. I'm eventually going to have a dropdown list of all the terms but entering the term id manually was a quicker way to get something useful out.
Using the Rules Condition Module that Prince Manfred attached in this forum @ 09/27/2011 as I do not understand Git 'yet'
Submitted by Prince Manfred on Tue, 09/27/2011 - 13:20.
Here is a new version of the...
And that is what my latest attached screenshot instructions came from (Just above), for the final third condition.
Quote from you: "Term-base Product Quantity Comparison"
I am not sure what you mean by Term-base Product Quantity Comparison? As far as I know Prince Manfred's condition module is just for making sure our other two conditions for quantity only work for a specific taxonomy term which was the missing link, which solves my problem. But the other two conditions still need to work with it, making three conditions in total. It worked really good for me.
Then for my next quantity range I just go to Home » Administration » Store » Configuration Product pricing rules and Add a new pricing rule and repeat what I have said above over again (Minus installing the module again of course) but for a different quantity range and repeat the process until I have got all my pricing ranges done.
If you use the latest version
If you use the latest version of the module it has a condition called Term-base Product Quantity Comparison. It lets you add up only the quantities of products with a certain Taxonomy term. This way you can purchase products not eligible for a bulk discount and not have them contribute for the count of whether or not the customer has enough eligible products in the cart. Pull it down from the module's project page with git:
http://drupal.org/sandbox/PrinceManfred/1291758
Is there anyway for you to edit the first post with this link and a brief summary, commercestudy? This thread is huge. It would help out anybody looking for info in the future.
-PM
Just set it up like you would
Just set it up like you would the Total order quantity comparison rule. Just add the field and term id for the Term-based product quantity comparison condition. It works for me, but that doesn't seem to mean anything every time ;)
Have put it as high up as I could
Thanks Prince Manfred.
I tried to put a link to your module up as high in this thread as I could, as I could not find an edit link on my first post. So replied to the second post.
Sorry, my comment was wrong here...
Sorry, my comment was wrong here...
Add condition for "Commerce order"
Hi Manfred,
I have a problem using your module for calculation of the shipping costs. Is ist possible to add the condition "order product has term" under "Commerce order" for using the data selector "commerce-order:commerce-line-items:0"? Attached I send you also an image of my configuration.
Please are so kind and give me some info
Best regards
Michael
Hey Michael, It looks like
Hey Michael,
It looks like you are using one of the really early releases that got posted here while I was cobbling this module together. Disable it, delete it, and grab the latest version from the project page: http://drupal.org/project/commerce_conditions
After you install it make sure to clear your site's cache. commerce-order:commerce-line-items:0 should be a valid data-selector for that condition. Let me know if you still have trouble with it.
Hi Manfred, now the condition
Hi Manfred,
now the condition is working! Thank you very much!
I'm using the condition for calculating the shipping costs. I have products, with shipping costs and products without shipping costs.
If I add a product with shipping costs to the basket, the rule ist working fine. If I add a product wothout shipping costs the rule works fine to.
But if I add a product with shipping costs and one without shipping costs the condition will calculate it for all products in the basket. I use as action the shipping methode "Flat rate".
Maybe there is a problem in the modules for the shipping methode "Flat rate". Please find attached the plugin for for the calculation and let me kindly know, what to change.
I'm looking forward to hearing from you
Thank you and best regards.
Michael
That's a limitation of the
That's a limitation of the flat rate module right now. There's no way to use the extra rules conditions module to get the kind of shipping functionality you're looking for. I'll take a look at what it would take to work it into shipping. We should maybe open an issue on the shipping module page for the feature request and see what they say too.
hello, many thanks for the
hello, many thanks for the help. I hope you find a solution. Otherwise I will open an issue on the shipping module page.
I'm looking forward to hearing from you again.
Best regards
Michael
I was able to implement a
I was able to implement a lightweight solution programmatically using Rules and PHP filter.
The rule below executes my custom php action whenever a product is added/removed from the cart, or when an order is updated (e.g., when the quantity of a line item may have changed).
In my case, I needed to change the book price from $9.95 to $8.00 if ordering 10 or more copies. So, I check to see if the line_item_label is the SKU of the book I am targeting ('mentors-new-evangelization') and whether the quantity is greater than 9.
Of course, you'll need to modify the code to suit.
{ "rules_bulk_discount_mentors" : {
"LABEL" : "Bulk discount on Sr. Johanna\u0027s Book: Mentors for the New Evangelization",
"PLUGIN" : "reaction rule",
"REQUIRES" : [ "php", "rules", "commerce_cart", "entity" ],
"ON" : [
"commerce_cart_product_add",
"commerce_cart_product_remove",
"commerce_order_update"
],
"DO" : [
{ "php_eval" : { "code" : "if (isset($commerce_order-\u003Ecommerce_line_items[\u0027und\u0027])) {\r\n $line_items = $commerce_order-\u003Ecommerce_line_items[\u0027und\u0027];\r\n foreach($line_items as $lid) {\r\n $line_item = commerce_line_item_load($lid[\u0027line_item_id\u0027]);\r\n \r\n if ($line_item-\u003Eline_item_label == \u0027mentors-new-evangelization\u0027 \u0026\u0026 $line_item-\u003Equantity \u003E 9) {\r\n $qty = $line_item-\u003Equantity;\r\n $price = 800;\r\n $line_item-\u003Ecommerce_unit_price[LANGUAGE_NONE][0][\u0027data\u0027][\u0027components\u0027][0][\u0027price\u0027][\u0027amount\u0027] = $price;\r\n $line_item-\u003Ecommerce_unit_price[LANGUAGE_NONE][0][\u0027amount\u0027] = $price;\r\n $line_item-\u003Ecommerce_total[LANGUAGE_NONE][0][\u0027data\u0027][\u0027components\u0027][0][\u0027price\u0027][\u0027amount\u0027] = $qty*$price;\r\n $line_item-\u003Ecommerce_total[LANGUAGE_NONE][0][\u0027amount\u0027] = $qty*$price;\r\n commerce_line_item_save($line_item);\r\n entity_get_controller(\u0027commerce_line_item\u0027)-\u003EresetCache(array($line_item-\u003Eline_item_id));\r\n }\r\n }\r\n}" } }
]
}
}
And to make the PHP code in the rule's action above a little bit clearer for presentation on this website, I have listed it below with linebreaks, apart from the Ctools export code.
if (isset($commerce_order->commerce_line_items['und'])) {
$line_items = $commerce_order->commerce_line_items['und'];
foreach($line_items as $lid) {
$line_item = commerce_line_item_load($lid['line_item_id']);
if ($line_item->line_item_label == 'mentors-new-evangelization' && $line_item->quantity > 9) {
$qty = $line_item->quantity;
$price = 800;
$line_item->commerce_unit_price[LANGUAGE_NONE][0]['data']['components'][0]['price']['amount'] = $price;
$line_item->commerce_unit_price[LANGUAGE_NONE][0]['amount'] = $price;
$line_item->commerce_total[LANGUAGE_NONE][0]['data']['components'][0]['price']['amount'] = $qty*$price;
$line_item->commerce_total[LANGUAGE_NONE][0]['amount'] = $qty*$price;
commerce_line_item_save($line_item);
entity_get_controller('commerce_line_item')->resetCache(array($line_item->line_item_id));
}
}
}
Thanks Carson, this works
Thanks Carson, this works (almost) perfectly! In my case I have UK VAT at 20% included in my prices. This rule works great for actually updating the price based on quantity, however it's not including VAT in the price. Is there anyway that I can slightly alter this rule so that it is included in the price that I have set in the PHP code?
Thanks for any help.
Rule for quantity discount per term
Hi,
Still no easy way for sort of Rule for "Discount for Quantity Range"?
I am looking for a rules answer for this, price_table is not working correct on multiple products combined.
EDIT: Hi, I am struggling with this, and this thread is helping me, but also confusing me..
Isn't it in pseudocode this easy:
1) First check whether a product (not node) has a term which says it has to have a discount within a certain quantity frame:
Term" discount_10euro_quantity 1_200" or something like this.
2) Then do a Data Comparison on Line Item > Quantity and test for above 1 and below 200 number?
So only the extra condition "Line item product has terms: has to be added??
The rule would be then something like this:
---
{ "rules_add_discount_per_term_quantity_gekloond_" : {
"LABEL" : "Add discount per term - quantity",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"REQUIRES" : [
"commerce_conditions",
"rules",
"commerce_line_item",
"commerce_product_reference"
],
"ON" : { "commerce_product_calculate_sell_price" : [] },
"IF" : [
{ "commerce_conditions_rules_condition_has_terms" : {
"line_item" : [ "commerce-line-item" ],
"field_name" : "field_discount10euro_for1_200",
"term_ids" : { "value" : { "1719" : "1719" } },
"require_all" : 0
}
},
{ "data_is" : {
"data" : [ "commerce-line-item:quantity" ],
"op" : "\u003C",
"value" : "200"
}
},
{ "data_is" : {
"data" : [ "commerce-line-item:quantity" ],
"op" : "\u003E",
"value" : "0"
}
}
],
"DO" : [
{ "commerce_line_item_unit_price_subtract" : {
"commerce_line_item" : [ "commerce_line_item" ],
"amount" : "10",
"component_name" : "base_price",
"round_mode" : "1"
}
}
]
}
}
This is a rule for ONE quantity_range on ONE discount possibility.
The scenario is the following in the rule above:
- 1) Add the condition 'Line item product has term' to see whether a discount is in place
- 2) Then do a Data Comparison on Line Item > Quantity and test for above a certain number and below a certain number.
I have a couple of big problems with this scenario.
1) I have to add a term for every discount-quantity-range.
2) I have to add that term to every product.
3) Next to this I have to build a lot of rules to follow every term with this.
Thanks a lot in advance for commenting on this
greetings, Martijn
More then a half year later
More then a half year later and still no solution for this! Price_table module is not working correct with more than one product on product display. Orther modules with complex rules are also not fitting this...will commerce ever get a correct price table solution for multiple products with multiple price tables per quantity?
Please reply if you have a solution for this!
Greetings, Martijn