Model
The model used isShopper\Core\Models\ProductTag. Unlike products, categories, or brands, the tag model has no admin wrapper and is not configurable via config/shopper/models.php. It uses the HasSlug trait, which generates unique, URL-friendly slugs with collision handling.
Database Schema
Tags Table
Pivot Table
Tags use the shared polymorphicproduct_has_relations pivot table. This is the same table used by categories, collections, channels, and related products. The polymorphic pattern lets all these models share a single pivot table instead of requiring a dedicated join table for each relationship type.
Slug Generation
TheHasSlug trait provides automatic slug generation with collision handling. When you set the slug attribute, the trait runs the value through Str::slug() and checks for uniqueness. If a slug already exists, it appends an incrementing suffix (-1, -2, etc.) until it finds a unique one.
findBySlug() static method that looks up a tag by its slug and throws a ModelNotFoundException if not found:
Relationships
Products
Tags connect to products through amorphToMany / morphedByMany polymorphic relationship via the product_has_relations table.
From the tag side:
Creating Tags
To create a tag, provide a name and a slug. TheHasSlug trait ensures slug uniqueness automatically:
Retrieving Tags
To get all tags ordered by name with their product count:Configuration
Disabling Tags
If you don’t need tags in your store, disable the feature inconfig/shopper/features.php:
Permissions
The admin panel generates four permissions for tag management:Components
Tags are managed under the product components configuration. To customize the admin UI:config/shopper/components/product.php: