Skip to main content
On this page
Docs

Developer Guide

This guide covers working with Product Customer List from the command line and from code.

Installation via WP-CLI

Install Product Customer List quickly with WP-CLI. Run the following command in your terminal:

Terminal
wp plugin install wc-product-customer-list --activate

You can also update the plugin using WP-CLI:

Terminal
# Check for updates first
wp plugin status wc-product-customer-list
# Update to the latest version
wp plugin update wc-product-customer-list

Pluggable functions

The plugin’s standalone helper functions are wrapped in function_exists checks, so code that loads earlier — a must-use plugin, or another plugin that loads first — can define its own version and the plugin uses that instead. For example, wpcl_admin_message(), the admin notice shown when WooCommerce is missing or too old, is declared as:

functions.php (plugin)
if ( ! function_exists( 'wpcl_admin_message' ) ) {
function wpcl_admin_message() {
// Renders the "requires WooCommerce" admin notice.
}
}

To replace one of these functions, define a function with the same name in a must-use plugin so it loads before Product Customer List.

The [customer_list] shortcode

Usage and attributes are documented in Configuration. Two notes for developers:

  • Without a product attribute, the shortcode resolves the product from the current post on single-product views; anywhere else it renders a prompt asking for the attribute instead of a list.
  • The free plugin renders shortcode output as a static table. The interactive toolbar inside shortcode output — export, print, email, search — is Premium.

How the plugin is organized

Single-purpose classes in the plugin’s lib/ directory:

  • Wpcl_Settings — registers the WooCommerce settings section and the optional WooCommerce-menu shortcut.
  • Wpcl_Options — defines every column and toolbar option and resolves settings and shortcode attributes into display parameters.
  • Wpcl_Data_Compilation — gathers the order items for a product.
  • Wpcl_Display — renders the customer table.
  • Wpcl_Shortcode — registers [customer_list] and passes its attributes to the options resolver.

Next Steps