Add missing promotion compatibility strategies

Created on 1 November 2018, about 6 years ago
Updated 20 November 2023, 12 months ago

Implementing remaining promotion compatibility strategies:

  • Only with the selected promotions
  • Any promotion except the selected promotions

✨ Feature request
Status

Needs work

Version

2.0

Component

Promotions

Created by

πŸ‡ΊπŸ‡¦Ukraine Oleksiy Lutsk πŸ‡ΊπŸ‡¦

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΉπŸ‡·Turkey rgnyldz

    Patch seems to apply without any issue bu nothing happens when I click on "Only with the selected promotions" or "Any promotion except the selected promotions"

    I'm on drupal 10.0.1, commerce 2.32 and php8.1

  • πŸ‡ΉπŸ‡·Turkey rgnyldz

    My mistake, I did not run db update and cleared cache.

  • πŸ‡ΉπŸ‡·Turkey rgnyldz

    I also have an edge case for you :)

    I created a content type called Campaigns so the admins can create a page containing the promotion information and display it on a page with a reference field to promotions. So they have to only work on one page for all the info like promotion itself and images, descriptions etc.

    But inside the node edit page the radio buttons inside the inline entity form(simple) do not work. I presume that the patch is specific for the promotion edit page ?

  • πŸ‡³πŸ‡΄Norway zaporylie

    It seems to me like this patch won't work with coupons as the coupon validation constraint calls Promotion::applies() and that happens after the promotion preprocess removes all the promotion adjustments and before the processor adds them back.

    Disclaimer - I didn't test that theory but working on something similar now so wanted to chime in.

  • πŸ‡§πŸ‡ͺBelgium bceyssens Genk πŸ‡§πŸ‡ͺ

    patch #20 seems to work for us with latest 2.x dev version.

  • πŸ‡«πŸ‡·France nicolas bouteille

    Hello,

    We have the same need than what was described on #9
    For Black Friday, we want to offer -50% on all products, but also -70% on some categories.
    Our clients need to be able to buy a product at -50% and another at -70% in the same cart / order.
    It looks like as described in #9, in Commerce right now, when a promotion in incompatible with another one, it means they cannot be used in the same cart / order at all, even though they don't affect the same product. Which I think is too bad :/
    I was actually surprised to discover this is the behavior so far.
    Since Lisa's idea has been posted 6 years ago, then reposted on #9 4 years ago, I can only imagine this requires a lot of work and will not be available anytime soon… but can I suggest that this idea be at least mentioned in the description / roadmap of this issue?

    Also, in the mean time, could you advise me on how you would implement my current need?
    I was thinking about adding a custom plugin to be able to exclude specific products or taxonomies.
    That way, I could create -50% on all products except one category, and another promo -70% on this specific category. Marking both promo compatible so that they can be both used at the same time but making sure on my end that they cannot affect one same product.

    That makes me think that somebody has probably already created this kind of excluding plugin?

    Thanks for your help.

    Nicolas

  • πŸ‡«πŸ‡·France nicolas bouteille

    Ok just some follow up, here's how I managed to create a new condition to exclude some products (I will do the same for categories)
    I just created a new plugin OrderItemExcludeProduct that extends OrderItemProduct and only overrides the evaluate() function to negate it:

    public function evaluate(EntityInterface $entity) {
        return ! parent::evaluate($entity);
      }
    

    I also took care of displaying a huge warning to make sure the person creating the promotion also adds another condition such as Specific product category AND selects 'Condition operator' : 'All conditions must pass'. If not, the consequence will be : the promotion will be applied on any product not excluded here, even if it does not match the other condition(s)...

    By the way, the default value for Condition operator is 'Only one condition must pass' but shouldn't it say 'At least one condition must pass'?
    I just tested this and it does not break if I have more than one condition passing...

Production build 0.71.5 2024