• Resolved dpitzer

    (@dpitzer)


    The latest release has broken the call wc_get_product_id_by_sku.

    I have had to go back and use SELECT post_id FROM $wpdb->postmeta WHERE meta_key=’_sku’ AND meta_value=’%s’ LIMIT 1 method.

Viewing 15 replies - 1 through 15 (of 24 total)
  • Did the DB upgrade to 3.6 execute succesfully?

    Thread Starter dpitzer

    (@dpitzer)

    Yes. It reported it did. I also took 3.6.1 with no problems.

    Can you please paste your WC System Status report?

    Thread Starter dpitzer

    (@dpitzer)

    I would need a secure place to put that. They contain too much information about the system and DB.

    Otherwise, what does the ‘Scheduled Actions’ tab say? Did all wc_update_product_lookup_tables_column actions complete?

    Thread Starter dpitzer

    (@dpitzer)

    All completed 721. Only pending is woocommerce_update_marketplace_suggestions

    Hmm… strange. Can’t test myself now, I’m on mobile.

    Thread Starter dpitzer

    (@dpitzer)

    Ok no problem. I’m still looking at it. I only upgrade our development server so the our live site is still good. One thing that I am thinking it might be is the dev server runs PHP 7.3

    Plugin Contributor Mike Jolley (a11n)

    (@mikejolley)

    wc_get_product_id_by_sku has passing unit tests so I don’t think it’s broken.

    
    SELECT posts.ID
    				FROM {$wpdb->posts} as posts
    				INNER JOIN {$wpdb->wc_product_meta_lookup} AS lookup ON posts.ID = lookup.product_id
    				WHERE
    				posts.post_type IN ( 'product', 'product_variation' )
    				AND posts.post_status != 'trash'
    				AND lookup.sku = %s
    				LIMIT 1
    

    Thats the query it uses. Perhaps the lookup table was not generated successfully. You can build it again from WC > Status > Tools > Regenerate.

    Thread Starter dpitzer

    (@dpitzer)

    This did correct the issue, thank you Mike!

    Thread Starter dpitzer

    (@dpitzer)

    I was wrong it only correct some items, half of our products fail the look up.

    Plugin Contributor Peter Fabian

    (@peterfabian1000)

    Hi @dpitzer
    you can check and execute pending/see failed tasks from WooCommerce > Status > Scheduled Actions. Can you please check over there if there is anything still pending/failed?
    Do you see any log messages in the WooCommerce > Status > Logs?

    Hi have same issue,
    WooCommerce > Status > Logs empty
    Status report is ok no problems
    “woocommerce_update_marketplace_suggestions is pending”

    Search not working by sku

    Any suggestions?

    • This reply was modified 5 years, 7 months ago by jura99.
    Dom F

    (@britbikerider)

    @peterfabian1000 After updating to 3.6.1. I have lost my lookup tables as well, regenerating them through WooCommerce > Tools > Regenerate Lookup tables does not work.
    Checking WooCommerce > Scheduled Actions all the table are showing regenerated but wc_product_meta_lookup is coming up as missing. I’m unable to search parts in the admin backend. I tried Rolling back to 3.6 with no luck

    Plugin Contributor Peter Fabian

    (@peterfabian1000)

    @britbikerider if the wc_product_meta_lookup is missing, can you please try to Deactivate WooCommerce and Activate it again? That should trigger the db delta procedure that creates tables.

    @jura99 Can you please check in your SQL database (e.g. via phpMyAdmin) if table wc_product_meta_lookup is populated?

Viewing 15 replies - 1 through 15 (of 24 total)
  • The topic ‘Woocommerce 3.6.1 Breaks wc_get_product_id_by_sku’ is closed to new replies.