#Updating from v2.1 to v2.2
I've tried to document as many of the breaking changes as I can. Although, if you have any custom integrations into Simple Commerce, I'd recommend that you review the changes.
composer update doublethreedigital/simple-commerce:^2.2
- Update dependency in
php please sc:upgradeto automate the majority of changes.
v2.2 contains a lot of updates to the way Simple Commerce works behind the scenes. There's a few notable changes to make if you're making use of Simple Commerce methods or facades.
$cart parameter on
CartCompleted event has changed type
Instead of the
$cart parameter being an
Entry object, it is now an
Cart Facade being phased out
Cart facade is being phased out. It's strongly recommended that you update any references of the
Cart facade to use the new
Order facade which contains all of the same methods as the Cart facade.
It will continue to function for now, however the plan is to remove it completely in the next few major releases.
Changes to Repositories
Simple Commerce used to split code into Repositories but it's been re-structured in v2.2, in order to cleanup the codebase for future development.
There's a few changes that you may need to make:
- Contracts have been renamed to remove
Repositoryfrom the name. Example:
- Repositories have moved from the
Repositoriesnamespace into ones for the individual features, like Order or Product.
- Repositories used to have separate
updatemethods. These have been merged into a single
savemethod which should be added to the end of a method chain, like below:
Order::find('x-y-z') ->data(['items' => [...]]) ->save();