• Resolved joelwarren

    (@joelwarren)


    This wasn’t working for a site of mine. I took a quick look into the code and made some changes.

    woocommerce-searchbysku.php lines 27-28:

    global $pagenow, $wpdb, $wp;
    if ((is_admin() && 'edit.php' != $pagenow) || !is_search()  || !isset($wp->query_vars['s']) || 'product' != $wp->query_vars['post_type']) {

    to

    global $pagenow, $wpdb, $wp, $wp_query;
    if ((is_admin() && 'edit.php' != $pagenow) || !is_search()  || !isset($wp->query_vars['s']) || !in_array('product', $wp_query->query_vars['post_type']) ) {

    It looked like the post_type check wasn’t matching up correctly so the search by sku functionality wasn’t working.

    https://www.ads-software.com/plugins/search-by-sku-for-woocommerce/

Viewing 5 replies - 1 through 5 (of 5 total)
  • StoyPenny

    (@stoypenny)

    I tried this but it is giving me the following error on the if statement:

    Warning: in_array() expects parameter 2 to be array, string given in C:my-local-site\wp-content\plugins\search-by-sku-for-woocommerce\woocommerce-searchbysku.php on line 28

    Was there something in your code that I was supposed change?

    Thread Starter joelwarren

    (@joelwarren)

    I came across this too in the backend of the website where this plugin is not needed.

    I pulled the is_admin && pagenow part out of that if statement and created a simple if (is_admin()) return statement above this.

    Sorry to not provide an example, I’m away from the computer right now.

    Thanks, @joelwarren. Your solution worked for me.
    For the record, I’m using wordpress 4.0 and Woocommerce v2.2.8.

    Plugin Author mattsgarage

    (@mattsgarage)

    Hi, a similar fix has been added in 0.6.1 thanks for the extra effort digging in to the issue and apologies for the long wait for a fix.

    Thread Starter joelwarren

    (@joelwarren)

    Champion, thanks mate

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Fix for 0.6.0 not working’ is closed to new replies.