Skip to content

Commit 11eea71

Browse files
committed
- Cart::getSubTotalWithoutConditions();
- $item->getConditions();
1 parent 27e7556 commit 11eea71

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

src/Darryldecode/Cart/Cart.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,22 @@ public function clearCartConditions()
508508
);
509509
}
510510

511+
/**
512+
* get cart sub total without conditions
513+
* @param bool $formatted
514+
* @return float
515+
*/
516+
public function getSubTotalWithoutConditions($formatted = true)
517+
{
518+
$cart = $this->getContent();
519+
520+
$sum = $cart->sum(function ($item) {
521+
return $item->getPriceSum();
522+
});
523+
524+
return Helpers::formatValue(floatval($sum), $formatted, $this->config);
525+
}
526+
511527
/**
512528
* get cart sub total
513529
* @param bool $formatted

src/Darryldecode/Cart/ItemCollection.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,17 @@ public function hasConditions()
6666
return false;
6767
}
6868

69+
/**
70+
* check if item has conditions
71+
*
72+
* @return mixed|null
73+
*/
74+
public function getConditions()
75+
{
76+
if(! $this->hasConditions() ) return [];
77+
return $this['conditions'];
78+
}
79+
6980
/**
7081
* get the single price in which conditions are already applied
7182
* @param bool $formatted

0 commit comments

Comments
 (0)