dazeh's avatar
Level 1

gloudemans/shoppingcart - Removing Cart from global

Hi all,

I'm building an e-commerce site with gloudemans/shoppingcart (https://packagist.org/packages/gloudemans/shoppingcart)

When I install it, it automatically allows use of the class "Cart" I want to extend this class but still use the class name; cart.

I cant seem to find reference anywhere that may relate to this being called automatically.

Any assistance would be great.

Edit -

So I discovered that laravel automatically sets alias' for facades. Is there anyway i can override this and stop it from creating a facade named cart without actually editing the vendor files?

0 likes
1 reply
Sinnbeck's avatar
Sinnbeck
Best Answer
Level 102

First of all disable auto discover for the package (replace with actual package name

"extra": {
    "laravel": {
        "dont-discover": [
            "barryvdh/laravel-debugbar"
        ]
    }
},

And follow the guide for the cart as if you are using old laravel, and change this line

'Cart' => Gloudemans\Shoppingcart\Facades\Cart::class,

Please or to participate in this conversation.