Hello,

I need another CA (conditional action) condition. A condition that will let me check if order contains any non-shippable items. Note that the current "check if an order can be shipped" condition (on negation) will not work on what I want to achieve. I want to check if the order contains non-shippable items (meaning that the 'shippable' tick box over at create product page is not checked).

You can:
1. Write a stand alone module to add this feature. OR
2. Provide me the code to use in the 'execute custom php code' available in the condition options.

Can anybody do this? Let me know. Thanks.

Comments

Sagar Ramgade’s picture

Hi,

Put the code below in the conditional action with execute php code (do not include php tags) :

$bool = FALSE;
foreach($order->products as $prod){
    if($prod->data['shippable'] == FALSE){
        $bool = TRUE;
    }
}
return $bool;

The code will return true even if an order consists of multiple products and one of them is non-shippable. Hope this helps.

Acquia certified Developer, Back end and Front specialist
Need help? Please use my contact form