The constants documented here can be defined in your site’s wp-config.php
.
For constants related to debugging, please refer to Debugging.
Disabling Back End and JSON Searches
↑ Back to top
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 topdefine( '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.
Role-based Caching
↑ Back to topdefine( '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 topdefine( '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 topWPS_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 AUTO
or 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.
Deferred Indexing of Variations
↑ Back to topWPS_DEFER_VARIATIONS_THRESHOLD
constant.
The default value of this constant is 3, meaning that when you update a variable product, it will re-index up to 3 of its variations and defer indexing of the remaining variations to the next eligible indexer run. If this constant is set to 0, none of a variable product’s variations will be index upon saving changes, but all will be re-indexed on the next eligible indexer run, this will help to reduce the wait to a minimum when so desired. Higher values will try to re-index as many variations when a product is updated, respecting the PHP resource limits of available time and memory.
So if you set this to a very high value, for example 100, and you have variable products with more than 100 variations, take into account that the limit established is potential and depends on the available PHP memory and execution time limits.
To defer all indexing of variations to indexer processing in the background:
define( 'WPS_DEFER_VARIATIONS_THRESHOLD', 0 );To process up to 10 variations when you edit and update a variable product and leave the rest for deferred background processing:
define( 'WPS_DEFER_VARIATIONS_THRESHOLD', 10 );Our recommendation is to leave the value of the constant at its default so as to ensure an acceptable trade-off between working on products and having them indexed through the indexer when it runs in the background. It is important to note that the indexer should be enabled at all times, to make sure that variations that are pending indexing will be taken care of. Also note that due to the deferred processing, some results pertaining to variations not indexed will only be included by the search engine after they have been processed.
Enabling [products] Shortcode Filtering
↑ Back to topdefine( 'WPS_SHORTCODES_PRODUCTS_FILTER', true );This will apply to all instances of the shortcode. Alternatively, the
woocommerce_product_search_filter_shortcode_products
filter can be used to enable it in certain conditions. Filtering of the [products]
shortcode can also be enabled or disabled using the woocommerce_product_search_filter_shortcode_products_enable()
and woocommerce_product_search_filter_shortcode_products_disable()
API functions, useful for spot-enabling filtering on specific instances for example in templates.
Disabling Filtering of the Divi Shop Module
↑ Back to topdefine( 'WPS_DIVI_SHOP_FILTER', false );This behavior can be modified individually for a given request context by implementing the
woocommerce_product_search_filter_divi_shop
filter.