Answers.Body: <p>I don't think avoiding an adjuster or plugin approach here really gains you anything much and it probably creates potential issues - it will likely just make the discount rules confusing as you can't really document the special conditions anywhere on those rules etc (and experience shows over time editors are likely to forget the special conditions and make mistakes with these sorts of hidden logic approaches).</p>
  
  <p>Personally I would approach this by listening to <code>onAddToCart</code> and <code>onRemoveFromCart</code></p>
  
  <p><a href="https://craftcommerce.com/docs/events-reference#commerce_cart.onaddtocart" rel="nofollow noreferrer">https://craftcommerce.com/docs/events-reference#commerce_cart.onaddtocart</a>
  <a href="https://craftcommerce.com/docs/events-reference#commerce_cart.onremovefromcart" rel="nofollow noreferrer">https://craftcommerce.com/docs/events-reference#commerce_cart.onremovefromcart</a></p>
  
  <p>In each of these I would call a function that inspects the order total and either adds the free item (if not already in the cart) if the total is high enough, or removes it if it is present but the order total slips below the desired total.  And you'd want to look at the item total, not the cart total presumably.</p>
  
  <p>To make it editor friendly, I would also add a control panel page that allows the editors to set the cart total threshold and the free product they get if the threshold is exceeded.  </p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-11-14T12:33:25.323Z
Answers.Text: Thanks Jeremy!
  
  One wrinkle is that the "free item" is _also_ available for purchase in the store (an its normal price), so while I'd use `onAddToCart`/`onRemoveFromCart` to automatically add it in my condition, I'd _also_ need an adjuster to make it free. Is that how you're seeing it?
  
  Yeah the only reason I was curious if it could be done without an adjuster was to keep it under client control (and in the "promotions" section).
Answers.UserDisplayName: Tim Kelty
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-11-15T01:14:51.130Z
Answers.Text: You could just duplicate the item perhaps - one a free version not normally shown, the other the main one??  Or you could use `onPopulateLineItem` perhaps to do the free making bit...but your adjuster, or however you do it, can add a CP section of its won fairly easily - we have a whole 'Tools' section where a bunch of those things live.  Ideally would be in Commerce itself but it's a relatively good solution even so...
Answers.UserDisplayName: Jeremy Daalder
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-11-12T23:28:16.743Z
Answers.LastActivityDate: 2017-11-12T23:28:16.743Z
Answers.UserDisplayName: Jeremy Daalder
Body: <p>I want to make a promotion where at a certain cart total threshold, if a particular product is in the cart, it would be free. (e.g. spend $50 and get a free mug).</p>
  
  <p>Trying to sketch out the best way to achieve this.</p>
  
  <p>It seems like if a discount had a a "Cart total" condition, I could pull it off w/o a custom adjuster. It has "Purchase Total", but that says only applies to the <em>matching</em> products, not the entire cart. In this case I would want to select the mug in the "products" condition, and set the percent discount to 100% (I think).</p>
  
  <p>Any ideas where to start?</p>
  
Tags: <plugin-craftcommerce><discounts><promotions>
Title: Commerce Discount: spend $X, get product free
ThreadText: # Commerce Discount: spend $X, get product free
  
  (Asked by: username_0 on 2017-11-08)
  
  I want to make a promotion where at a certain cart total threshold, if a particular product is in the cart, it would be free. (e.g. spend $50 and get a free mug).
  
  Trying to sketch out the best way to achieve this.
  
  It seems like if a discount had a a "Cart total" condition, I could pull it off w/o a custom adjuster. It has "Purchase Total", but that says only applies to the *matching* products, not the entire cart. In this case I would want to select the mug in the "products" condition, and set the percent discount to 100% (I think).
  
  Any ideas where to start?
  
  **Tags:** plugin-craftcommerce, discounts, promotions
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2017-11-12. Score: 1
  
  I don't think avoiding an adjuster or plugin approach here really gains you anything much and it probably creates potential issues - it will likely just make the discount rules confusing as you can't really document the special conditions anywhere on those rules etc (and experience shows over time editors are likely to forget the special conditions and make mistakes with these sorts of hidden logic approaches).
  
  Personally I would approach this by listening to `onAddToCart` and `onRemoveFromCart`
  
  <https://craftcommerce.com/docs/events-reference#commerce_cart.onaddtocart>
  <https://craftcommerce.com/docs/events-reference#commerce_cart.onremovefromcart>
  
  In each of these I would call a function that inspects the order total and either adds the free item (if not already in the cart) if the total is high enough, or removes it if it is present but the order total slips below the desired total. And you'd want to look at the item total, not the cart total presumably.
  
  To make it editor friendly, I would also add a control panel page that allows the editors to set the cart total threshold and the free product they get if the threshold is exceeded.
  
  > **Comments:**
  > **username_0**: Thanks username_1!  One wrinkle is that the "free item" is _also_ available for purchase in the store (an its normal price), so while I'd use `onAddToCart`/`onRemoveFromCart` to automatically add it in my condition, I'd _also_ need an adjuster to make it free. Is that how you're seeing it?  Yeah the only reason I was curious if it could be done without an adjuster was to keep it under client control (and in the "promotions" section).  
  > **username_1**: You could just duplicate the item perhaps - one a free version not normally shown, the other the main one??  Or you could use `onPopulateLineItem` perhaps to do the free making bit...but your adjuster, or however you do it, can add a CP section of its won fairly easily - we have a whole 'Tools' section where a bunch of those things live.  Ideally would be in Commerce itself but it's a relatively good solution even so...  
  
  ---
  
  