Add User Role To Valid Customer Types
By default Autoship Cloud will only update customers in QPilot that have a Wordpress User Role of 'customer'. Autoship Cloud lets you customize the valid customer types using the 'autoship_valid_customer_types' filter.
To expand the accepted customer types to include other user roles (such as 'subscriber' in the example below), add the snippet below to your child theme's functions.php file, replacing the user role with the one you would like to include.
IMPORTANT! Always test updates and new code on a staging site before adding it to your Live / Production site.
Example:
/** * Update Valid roles to include subscriber * @param array $valid_types Array of current QPilot valid roles * @return array The filtered roles. */ function xx_add_valid_customer_role ( $valid_types ){ $valid_types[] = 'subscriber'; return $valid_types; } add_filter('autoship_valid_customer_types', 'xx_add_valid_customer_role', 10, 1);