vanilophp/framework

cart item adjustable

Closed this issue · 3 comments

stokic commented

Hi,

I'm not 100% sure, it was quick look but shouldn't this line https://github.com/vanilophp/framework/blob/master/src/Foundation/Models/CartItem.php#L30
be return $this->total() + $this->adjustments()->total();
?

also here https://github.com/vanilophp/framework/blob/master/src/Foundation/Models/Cart.php#L35 something like:

return $this->items->sum(fn (CartItem $item) => $item->itemsTotal());

then the adjustments are taken into account...

Thanks

stale commented

This issue has been automatically marked as stale because it has not had recent activity. It will be closed within 3 days if no further activity occurs. Thank you for your contributions.

Closing because of being stalled for 3 days without activity.

Just noticed this after stalebot has closed it. The answer is that itemsTotal() comes from the Adjustable interface.

The method was meant to return the "net" price without any adjustments. As the comment suggests, the name was chosen very stupidly (bravo me 😅) and will be changed soon.