discount cart rules
This commit is contained in:
parent
d3a47e0949
commit
30eea44d48
|
|
@ -13,14 +13,16 @@ class CartRuleResource extends JsonResource
|
|||
|
||||
public function toArray($request): array
|
||||
{
|
||||
$is_fixed = str_contains($this->action_type,'fixed');
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'name' => $this->name,
|
||||
'description' => $this->description,
|
||||
'action_type' => $this->action_type,
|
||||
'amount' => str_contains($this->action_type,'fixed')?
|
||||
core()->formatPrice($this->discount_amount, $this->currency):
|
||||
$this->discount_amount.'%'
|
||||
'is_fixed' => $is_fixed,
|
||||
'is_discount' => $this->discount_amoun >0,
|
||||
'amount' => (double) ($is_fixed ?
|
||||
core()->convertPrice($this->discount_amount, $this->currency):
|
||||
$this->discount_amount)
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue