Hello,
I have been trying to apply a fee based on the total number of items in a shopping cart minus one and I am having some difficulty getting it to work properly using conditional actions. I would like to have a $2 fee be added for every additional item in a shopping cart. For example:
Total number of items: 1
No fee
Total number of items: 2
$2 fee
Total number of items: 3
$4 fee
etc...
I first tried "Check an orders number of products" in conditional actions using the following settings.
Total is greater than or equal to specified value.
Product count value = 1
I added two items to the shopping cart and a fee of $4 was added not $2.
I then tried the following condition using Execute custom PHP code to test the "Check an orders number of product" condition and I received the same result. I always receive the total number of products multiplied by the fee.
$items = uc_cart_get_contents();
$item_count = count($items);
if ($item_count > 1 ) {
return TRUE;
}
I believe the following may work, but it is more of an action than a condition.
$items = uc_cart_get_contents();
foreach ($items as $item) {
$fee = ($item->qty - 1) * $fee;
}
return $fee;
Does anyone have any idea how I can accomplish this?
Thank you