1

I am trying to add the condition inside a commerce notification: "Order has one or more products where the sku contains.". What I basically need is "Order has only products where the sku contains".

The string that must be contained in the SKU is FOOBAR_.

The operator is =.

The amount: <?php print count($commerce_order->commerce_line_items); ?>

So the condition should just be true when all of the order's line items' products contain FOOBAR_ in their SKUs. But the php replacement does not seem to work. In the tooltip under PHP EVALUATION it says:

PHP code inside of <?php ?> delimiters will be evaluated and replaced by its output. E.g. <?php echo 1+1?> will be replaced by 2. Furthermore you can make use of the following variables: $commerce_order

When I put in a hardcoded amount it works, but then its not dynamic, obviously.

enter image description here

  • print count($commerce_order->commerce_line_items); return a number and you want compare it with string ? – Yusef Mohamadi Sep 7 '16 at 11:28
  • Maybe you should have a look at Rules debugging, similar to what is described here – Pierre.Vriens Sep 7 '16 at 12:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.