Upgrade Guide: v3.x to v4.0
- Previous upgrade guides
To get started with the upgrade process, follow the below steps:
1. In your
composer.json file, update the
doublethreedigital/simple-commerce version constraint:
2. Then run:
1composer update doublethreedigital/simple-commerce --with-dependencies
3. You may also want to clear your route & view caches:
1php artisan route:clear2php artisan view:clear
4. Simple Commerce will have attempted upgrading some things for you (config changes, blueprint updates, etc). However, it's possible you will need to make some manual changes, along with some testing. Please test before you push to production!
Medium: Support for PHP 8.0 and Laravel 8 has been dropped
Simple Commerce has dropped support for both PHP 8.0 and Laravel 8. Leaving PHP 8.1 and Laravel 9 the only current versions supported.
These versions have been dropped to allow for Simple Commerce to take advantage of new PHP & Laravel features like proper Enums & Named Parameters.
Medium: Changes to how coupons are stored
Previously, coupons were stored as collection entries. However, they've now been moved into their own Stache 'thing' to give Simple Commerce greater power over how they work.
All of your existing coupons should be migrated over automatically during the upgrade process. If this hasn't happened, follow these steps:
- Create a new folder:
- Copy all of your coupons entries to that new folder from
- Change the file extension for the coupon files from
- Inside the coupon files, change
- Also inside the coupon files, add the coupon code like so:
- Now, you can delete the Coupons collection & remove the
couponsarray from the
contentarray inside your Simple Commerce config file.
- Additonally, you will need to replace the fieldtype of the 'Coupon' field on your Orders blueprint. You should change it from the Entries fieldtype to the new, Coupons fieldtype.
If you're interacting with the Coupons API directly (eg. with PHP code), you shouldn't be required to make any changes. If you do end up needing to make some, please open an issue so this guide can be updated.