How to enable Debugging ↑ Back to top
Add the following lines in
wp-config.php to have general PHP and WordPress warnings, error messages and status information from the WooCommerce Product Search extension logged to the site’s
debug.log file. The latter is usually located in the
define( 'WP_DEBUG', true ); define( 'WP_DEBUG_LOG', true ); define( 'WP_DEBUG_DISPLAY', false ); define( 'WPS_DEBUG', true );
To log main query times, enable the option as described in the General settings.
Debugging Scripts and Styles ↑ Back to top
If you would like the extension to use non-minified scripts and styles, also add:
define( 'WPS_DEBUG_SCRIPTS', true ); define( 'WPS_DEBUG_STYLES', true );
Disabling Back End and JSON Searches ↑ Back to top
The General settings provide options to power back end and JSON product searches. The settings can be overridden by setting the following constant:
define( 'WPS_EXT_PDS', false );
While the constant is set to
false, the extension will not power back end or JSON product searches and the corresponding options are disabled.
Disabling REST API Searches ↑ Back to top
The General settings provide the option to power REST API product searches. The option can be overridden by setting the following constant:
define( 'WPS_EXT_REST', false );
While the constant is set to
false, the extension will not power product searches via the REST API and the corresponding options are disabled.
DOM Parsing ↑ Back to top
WPS_DEBUG_DOM constant to expose additional information during DOM parsing.
define( 'WPS_DEBUG_DOM', true );
This applies when accurate optimization is used to handle the requests of the search engine’s filters (when enabled in the General settings).
Role-based Caching ↑ Back to top
Introduced in version 3, role-based caching improves performance as role-sensitive content can be cached. This can be disabled by setting the following constant:
define( 'WPS_ROLES_CACHE', false );
When this constant is set to false, role-based caching is disabled. This can be used to benchmark performance with and without role-based caching and also verify whether a specific caching system is effectively having an impact for visitors who are logged in.
Group-based Caching ↑ Back to top
Group-based caching requires the Groups membership and access control plugin, support is introduced in version 3.
Enabled by default, it improves performance as group-sensitive content can be cached. For example, access to certain products could be restricted to members of specific groups, such as when a store caters to distributors and the general public.
This can be disabled by setting the following constant:
define( 'WPS_GROUPS_CACHE', false );
When the constant is set to false, group-based caching is disabled. As with the related constant for roles, this can be used to benchmark performance with and without group-based caching and also verify whether a specific caching system is effectively having an impact for members who are logged in.
Object Limits ↑ Back to top
As of version 3, the search engine introduces constants that allow to limit the number of objects it will take into account during request processing. This can have a positive effect on shops with large sets of products or variations.
The following constants can be used to fine-tune or disable object limits:
WPS_OBJECT_LIMIT controls whether fixed or adaptive object limits are used. The constant can be set to a specific integer value to limit the number of objects, it can be set to
0 (zero) to disable object limits so that potentially unlimited numbers of objects could be processed (at the risk of exceeding available processing resources), it can be set to
AUTO for adaptive limits (which are used by default) and
AUTOREPORT for adapative limits and where the system will log the adaptive limit used (this should only be used during tests).
WS_OBJECT_LIMIT_FACTOR is used to modify the adaptive limits with
WPS_OBJECT_LIMIT set to
AUTOREPORT. Its default value is
4, higher values can be used to reduce the number of objects that will be processed during a request. Lower values than the default are not recommended.
As an example, these values could be used during debugging:
define( 'WPS_OBJECT_LIMIT', 'AUTOREPORT' ); define( 'WPS_OBJECT_LIMIT_FACTOR', 5 );
The obtained effective object limit is shown in the site’s debug.log when requests are processed.