• Resolved sjregan

    (@sjregan)


    Hi,

    It appears that Relevanssi v3.6.2.2 (and maybe earlier) prevents the WooCommerce REST API returning results when using the ‘search’ query parameter.

    When the plugin is disabled the API returns products in the response body as expected, when the plugin is enabled the API response code is still 200 however the body is empty.

    Any advice on how to get around this is appreciated.

    Thanks, SJ.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Mikko Saari

    (@msaari)

    Here’s how you can disable Relevanssi: https://www.relevanssi.com/knowledge-base/how-to-disable-relevanssi/

    Does that help?

    Thread Starter sjregan

    (@sjregan)

    Yes, very helpful thank you. It would be great for the plugin ecosystem if this issue was addressed within the plugin itself, even better if you could bring support for search rankings into REST API responses.

    For others with the same issue I used the ‘rest_api_init’ hook to only disable the plugin during REST API requests. My hook contained:

    remove_filter('posts_request', 'relevanssi_prevent_default_request'); 
    remove_filter('the_posts', 'relevanssi_query', 99);
    Plugin Author Mikko Saari

    (@msaari)

    Unfortunately the REST API is built in a way that’s not compatible with Relevanssi. It would require changes to the REST API, and I’ve understood the core developers are not very keen on that.

    To use Relevanssi with REST API, you have to create a separate end point that uses Relevanssi to fetch the results.

    But yes, I’ll add the disable code to Relevanssi in the next version.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Relevanssi breaks WooCommerce REST API Product Search’ is closed to new replies.