Extending Shopper
Learn how to extend Shopper with custom features and functionalities
Although Shopper is primarily designed for e-commerce sites and has many associated features, you are free to add or modify existing ones.
Why extend Shopper
One might ask, knowing that the purpose of setting up an e-commerce site is simply to make the whole system work without always wanting to add to it.
For example if you want a blog on your store, a section for a KYC, or maybe a forum, instead of creating another project to manage this you can directly extend Shopper to manage all this in the same administration area.
How to extend Shopper
To add new features to Shopper, the first thing you need to do is to register a new element in the sidebar by creating a sidebar class (for example RegisterCustomMenu, which extends Shopper\Sidebar\AbstractAdminSidebar) and listening to the SidebarBuilder event with it in your AppServiceProvider. See Extending Shopper for the sidebar class:
namespace App\Providers;
use App\Sidebar\RegisterCustomMenu;
use Illuminate\Support\ServiceProvider;
use Shopper\Sidebar\SidebarBuilder;
class AppServiceProvider extends ServiceProvider
{
public function register(): void
{
$this->app['events']->listen(SidebarBuilder::class, RegisterCustomMenu::class);
}
}The rest of the configuration will be done using the configuration files in the config/shopper/ folder
/routes.phpfor the routes that should be dynamically loaded for the admin panel/admin.phpfor the admin panel configuration (URL prefix, domain, pages, roles, brand).
We will deal with all this in more detail later.
How not to extend Shopper
It should go without saying, but we'll say it anyway just in case...
Don't ever, for any reason, ever, no matter what, no matter where, or who, or who you are with, or where you are going or...
or where you've been... ever, for any reason, whatsoever, edit the files inside /vendor/shopper. Or any other Composer package.
Anything you do will get blown away and you'll lose those changes forever and ever amen.
You should instead build addons, extensions, and submit pull requests to admin (after checking with the team first if we'll accept them). Thanks!
Last updated on
Edit on GitHub