Customers
Automatic customer account creation
Unless you disable the bnomei.kart.customers.enabled
configuration, the Kirby Kart plugin will automatically create a Kirby CMS user account with the role customer
when completing an order and providing an email address. If a user with the same email address already exists, it will assign that user to the order instead.
Since the plugin checks for customers in a few places you can add multiple valid roles to bnomei.kart.customers.roles
with the first one being the default to be assigned when creating customers.
It is totally up to you whether you provide your customers with a way to log in to that account. If you do not, the user accounts will only be used within the panel to link orders and users.
Add sign-up and login forms (with or without magic-link emails). Your customers can view their previous orders, view a Gravatar image, or access additional services you might offer only to registered customers.
Blueprint and Roles
The Kirby Kart plugin registers a single user blueprint/role named customer
. This user has no access to the panel and has two hidden fields to store the cart and wishlist. You can check if a Kirby user object is accepted by the Kart plugin as a customer with $user->isCustomer()
.
Available User Methods
The plugin adds a few user methods to your setup. They are not limited to users with the customer
role, but some might only yield useful results for those.
$user->cart()
$user->completedOrders()
$user->gravatar($sizeInPixel)
$user->hasPurchased($product)
$user->isCustomer()
$user->kart()
$user->orders()
$user->sendMagicLink($success_url)
$user->softDelete()
$user->wishlist()
Soft deletes
Instead of completely deleting a user account, you can initially "soft" delete it to maintain relationships with orders. The Kirby Kart plugin will reset the password and change the role to deleted,
thus locking the user out of the login and sign-up from Kart (since the new role is not in the customer.roles
array from above). You can read more about soft deletes here.
Data stored in the CMS
The Kirby Kart plugin saves the cart and wishlist to the user's content file and the provider's customer ID if known. Read more about stored data here.