Drupal 9 image field migration

Black Friday/Week is ongoing, promotions were prepared and already available on production website. But one thing we missed to test is the Compatibility with other promotions options.

We set 15% sale for all products in store. But some of our products need to have 30% cutoff. On products view modes everything works fine - prices displayed with correct promotions. But when customer added to the cart 1 Product from 15% price and other one with 30%, the second one doesnt have promo in the cart at all! Compatibility for main 15% promo was set to "Not with any other promotions". That's was the issue.

Commerce promotion module have a lot of conditions which you can set to promo. But "Negotiation" conditions missed there. I dont know why this simple stuff is not included in contrib module yet. The issue was fixed by simply copying OrderItemProduct condition from commerce_product module to custom and change return value to opposite.

  * {@inheritdoc}
 public function evaluate(EntityInterface $entity) {
  // ...
   return !in_array($purchased_entity->getProductId(), $product_ids);

So products which have referenced in another promotions (with 30% in this example) should be added to "Negotiation products" reference in main promotion.

Now all our products have 15% promo and some of them 30%.


Add new comment

The content of this field is kept private and will not be shown publicly.
  • No HTML tags allowed.