Manage inventory locations, warehouses, and fulfillment origins for multi-location stock tracking.
Locations represent physical places where you store inventory and ship orders from: warehouses, retail stores, fulfillment centers, or even your apartment. Each location has its own address and can track stock independently, so a product can have 50 units in your Paris warehouse and 20 in your New York store.When Shopper is first installed, the setup wizard creates a default location using your store’s address. All stock mutations target this location unless you specify another one. If your business ships from multiple places, you can add more locations and assign stock to each one.
Model
The model used is Shopper\Core\Models\Inventory. It implements Shopper\Core\Models\Contracts\Inventory and is configurable via config/shopper/models.php.
Extending the Model
To add custom behavior, extend the model and update your configuration:
namespace App\Models;use Shopper\Core\Models\Inventory as BaseInventory;class Inventory extends BaseInventory{}
Every stock mutation (increase, decrease, set) on any product or variant creates an InventoryHistory record tied to a specific location. This is how Shopper tracks stock per location.
$location->histories; // Collection of InventoryHistory records
Query Scopes
The default scope returns the location marked as the default inventory. This is the location used by InitialQuantityInventory when setting stock during product creation.
use Shopper\Core\Models\Inventory;$defaultLocation = Inventory::query()->default()->first();
How Locations Connect to Stock
When you call mutateStock(), decreaseStock(), or setStock() on a product or variant, you pass an $inventoryId. This ties the stock mutation to a specific location:
The default location is used as the origin address for shipping calculations and as the fallback when stock operations do not specify a location. Only one location can be the default.
Deleting a location removes all inventory history records tied to it. This affects stock levels for every product that had stock in that location. Proceed with caution.
Components
To customize the admin UI for location management:
php artisan shopper:component:publish setting
Location-related components in config/shopper/components/setting.php: