Laravel Shopping Cart Package
Laravel 9 Support
Rounding sucks, and most of its caused when we round too early.
To fix this I've removed most of the formatting options to LaraCart except on totals.
This fixes tons of issues and gives us better results.
Hey All!
I want to start off with, I'm sorry. LaraCart has been needing some love lately, as they are numerous (but minor) bugs that made some significant changes on how taxes / discounts work in tandem.
That being said, I've started on a new version of the package that should solve the broad cases of taxation / discount issues.
To Summarize what has changed:
The sub totals / totals / net totals were filled with passable arguments to have tax / formatting and more. This cause maintablity issues as they weren't turley sub totals in some ways.
These have been revamped to only be singular. They will only show the proper sub totals etc. If a function needed an extra param those were removed and renamed
Price use to be the sub total and now has been converted just to be the actual price (silly of me right?) .
Firstly, based on the most used practice taxation happens AFTER discounts. This has become the default and currently the only way in 2.0.
The reason behind this is complicated, but to put shortly each item should be its own line item that correctly tracks it's own discount / taxation.
There has been massive problems when it comes to rounding / discounts / taxation when laracart was using the sub total function with the QTY. This would lead to improper rounding and wrong taxation in some cases.
Now, each item is a line item to calculate the proper taxation / discounts etc.
There are some features missing (sorry...) , eventually can be put back if there was an actual need for it.
There are other changes that may not be listed here , such as signature changes. A upgrade guide will be put out before full release.
Thanks for reading if you've made it this far.
Also would like to thank
@dennisoderwald for sponsoring LaraCart!
Upgrade Guide https://github.com/lukepolo/laracart/blob/2.0/upgrade-1.0-2.0.md
-- Docs will be updated this week!
My tests are currently unable to run php 8 because of a dependency. but you can try to use as it "should" work.
#268
This should solve PHP7.4 depreciating of money_fomrat. Also it should solve windows not being able to use LaraCart at all.
International formatting has been replaced with currency code in the config.
/*
|--------------------------------------------------------------------------
| The currency code changes how you see the actual amounts.
|--------------------------------------------------------------------------
| This is the list of all valid currency codes
| https://www2.1010data.com/documentationcenter/prod/1010dataReferenceManual/DataTypesAndFormats/currencyUnitCodes.html
|
*/
'currency_code' => 'USD',
formatMoney signature has changed
public static function formatMoney($number, $locale = null, $internationalFormat = false, $format = true)
public static function formatMoney($number, $locale = null, $currencyCode = null, $format = true)
So please look through your code and replace anytime that you are using the $internationalFormat
.