Buy X get Y won't work when buying a $0.00 product

Created on 3 February 2025, 2 months ago

Describe your bug or feature request.

When creating a Buy X get Y promotion, if the Buy condition product has a price of zero, the promotion will not apply.

See here:
https://git.drupalcode.org/project/commerce/-/blob/3.0.x/modules/promoti...

      if ($order_item->getAdjustedTotalPrice()->isZero()) {
        continue;
      }

It makes sense not to apply a discount to a product that has a price of zero resulting in a negative price, but if X is zero and the promotion applies to Y, and does not apply to X, then I don't see why X cant be zero.

Proposed resolution

Only continue if the order item has zero price AND is in the get_condition.

Feature request
Status

Active

Version

3.0

Component

Promotions

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @tonytheferg
  • 🇮🇱Israel jsacksick

    hm... I think this is done to prevent a discounted order item to be considered for as a BUY item, otherwise we could end up triggering an extra BUY X GET Y promotion even though the intent is for the customer to pay for the BUY items...

  • Thanks for the response @jsacksick. Couldn't we still have the same result by adding a check to see if the order item is in the get condition (get Y), as it would have to be in the get condition to qualify for a promotion?

  • 🇮🇱Israel jsacksick

    This plugin is really complex as is... Feel free to give it a shot as I personally don't have the bandwith to look into it.

  • Okie doke. For right now I just have that check commented out in a local patch, as I know how this site is using Buy x get y. Maybe on a rainy day I will get lucky and figure it out.

    Thanks!

Production build 0.71.5 2024