Jump to content

Padloper 009: Customers and Customer Groups


Recommended Posts

Customers and Customer Groups are new features in Padloper 009.

Customers

You can add/remove this optional feature at any time via /admin/shop/configure-padloper/’.

This feature does not require the 'Customer Groups' feature. 

Please note that there is no direct relationship between a 'shop customer' and an 'order customer'. This decoupling allows for a better delineation between guest and non-guest checkouts. The field for storing order customers is separate from the field for storing shop customers. The former is a 'permanent' record of a transaction (an order) in your shop. 

There is no direct link between a shop customer and a ProcessWire user, until you link them. Padloper allows you to do this easily. You can add customers to your shop either via the API or the admin. Note:

  • When creating a customer, you have the option to create a (ProcessWire) user account for them as well. You can also do this later when editing the customer.
  • Padloper does not handle the customer registration for you. This is because some devs prefer to send customer a link to register whilst others prefer emailing a temporary password to the customer. Padloper allows you to handle the registration and pass the details back to it to email to the customer. Padloper passes the new customer details, new user details and the temporary password set to the new user to the partial template 'customer-registration-request-email-content-html.php'. Devs can then use that information to handle customer registration.
  • When you add a customer, they get the role 'padloper-customer'.
  • A customer linked to a ProcessWire user is a 'registered customer'. In this case, the $customer->userID equals $user->id and $customer->email is $user->email.
  • Currently, in case you had existing users in your shop that were customers prior to Padloper 009, Padloper does not currently link those users to the customers. You can do this via the API.
  • If you change a 'linked' user's email, the email of the corresponding customer will also be changed to keep them in sync. The same thing happens if you edit the email of a linked (registered) customer; the corresponding user's email will also be amended. 
  • If you delete a ProcessWire user linked to a Padloper customer, the customer will be delinked, i.e. will no longer be a registered customer and $customer->userID will be 0.
  • If you delete a registered Padloper customer, the corresponding ProcessWire user will also be deleted. 

It is possible to email a customer directly from the admin. 

A customer can have multiple addresses. These can be of types:

  1. Primary Shipping
  2. Shipping
  3. Primary Billing
  4. Billing

A customer can only have one Primary Shipping and one Primary Billing address.

The 'customer view' page allows you to see the details of the last 10 orders of the customer and the total of all their orders to date.

With the customers  feature, you can pre-populate address details of logged-in customers for a better checkout experience. You can also use this feature to build customer dashboards, address books, etc. as @alexm points out here.

Currently, there is no dedicated API to retrieve, amend, etc. a customer. This is planned. For now, you can get a customer as follows:

<?php

namespace ProcessWire;

$email = "mario@blaze.br";
$customer = $padloper->get("template=customer, customer.email={$email}");

if(!$customer instanceof NullPage){
  // CUSTOMER FOUND
  
  /** @var WireData $customerBasics */
  $customerBasics = $customer->padloper_customer;
  /** @var WireArray $customerAddresses */
  $customerAddresses = $customer->padloper_customer_addresses;

  bd($customer, __METHOD__ . ': $customer - at line #' . __LINE__);
  bd($customerBasics, __METHOD__ . ': $customerBasics - at line #' . __LINE__);
  bdb($customerAddresses, __METHOD__ . ': $customerAddresses - at line #' . __LINE__);
}

Customer Groups

You can add/remove this optional feature at any time via /admin/shop/configure-padloper/’.

This feature requires the 'Customers' feature. 

The Customer Groups feature allows you to segment your customers using certain criteria. The segmentation allows you to target specific customers for various purposes including marketing, loyalty services, discounts, statistical analysis, bulk emailing, etc. You will need to implement such actions per your needs, e.g. via an addon, etc.

A customer can belong to more than one Customer Group. You can create unlimited Customer Groups.

Currently, you need to manually create Customer Groups and add them to Customers. However, in future, you will be able to:

  • Use a GUI query builder to create a customer group then apply it to matching customers. For instance, a Customer Group named 'Europe High' with the criteria "order > 500, country = Italy|Switzerland"
  • Automatically add a Customer to a Customer Group if they meet the criteria. E.g., if a customer places an order and the customer's order totals becomes greater than >= 500 and the customer country is Italy or Switzerland, Padloper will automatically add them to the above 'Europe High' Customer Group.

Screenshots

001_customers_screenshot.png

002_customers_screenshot.png

003_customers_screenshot.png

004_customers_screenshot.png

005_customers_screenshot.png

006_customers_screenshot.png

007_customers_screenshot.png

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...