facetwp woocommerce rest api check

djrmom

{{gist file=”custom-hooks.php” lang=”php”}}
<?php
/**
** makes woocommerce’s is_rest_api_request false when the rest api request is from facet
** needs to load earlier so a custom plugin is recommended (https://facetwp.com/how-to-use-hooks/)
**/
add_filter( ‘woocommerce_is_rest_api_request’, function( $request ) {
if ( false !== strpos( $_SERVER[‘REQUEST_URI’], ‘facetwp’ ) ) {
return false;
}
return $request;
} );
{{/gist}}