• 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 9 replies - 16 through 24 (of 24 total)
  • I had the same problem. I solved it by running pending task manually
    wp-admin/admin.php?page=wc-status&tab=action-scheduler&status=pending

    @peterfabian1000
    Hi, thanks for your reply
    Looks like everything is okay
    https://ibb.co/MMtcWYJ

    @szamaniwp
    Did it twice. No luck still pending.

    Hi all,

    I am experiencing an error after updating to WC 3.6.1 – Can anyone assist on how to resolve this error please?

    Below error message:

    Classes that extend the WooCommerce/WordPress REST API should only be loaded during the rest_api_init action, or should call WC()->api->rest_api_includes() manually.

    Dom F

    (@britbikerider)

    @peterfabian1000
    I tried as you said on a separate site and it still is missing the tables

    Plugin Contributor Peter Fabian

    (@peterfabian1000)

    Hi @glamandcode,

    this is a notice we’ve added for plugins which are using REST API classes during non-REST API requests. Please try to disable your plugins (other than WooCommerce) one by one to find which plugin is causing this and please contact the author of the respective plugin for update.

    @britbikerider, were you able to find any errors in the log files? If there is no errors in WC, PHP and MySQL log files, someone would need to have a look at it to troubleshoot, please try to reach out via https://woocommerce.com/contact-us/.

    I too have this issue. I noticed that wp_wc_product_meta_lookup has no SKUs and all data is either NULL or 0. This looks to be a new table so it seems the update failed but gave no indication.

    All my data looks like:
    '12', '', '0', '0', NULL, NULL, '0', NULL, 'instock', '0', '0.00', '0'

    I regenerated the Product lookup tables before I looked at this table as I was following this thread.

    What I had to do to get this working was to do this:
    IN WC > Status > Tools:
    – Upgrade database (Did this because I wanted to make sure it upgraded properly even though it was already done with no errors)
    – Manually ran: wc_update_product_lookup_tables_column with Args: 'column' => 'sku'

    Now my table has data. I ran Regenerate to see if this was the reason it had empty data but it seemed to be fine.

    Since I now have data but not all of it was correct, I manually ran the rest of the pending Scheduled Actions and I checked the table after every run to see if there was any issues. None was found.

    Not sure why this way worked to recover my system but it did.

    My DB was already updated and I had the new tables.

    I want to make note that I updated from 3.5.7 to 3.6.2 in-case that helps with anything.

    Ahaa! i also hit this situation in my multisite. I didn’t see wc database upgrade warning message as i saw it before but then, it works after i go wp cli run upgrade like this.

    wp wc update --url=<my subsite>.

    But i have to run it one by each my subsite which currently having more than 190++.

    I hope WooCommerce can simplify it by allowing user to upgrade all subsite oneshot like this

    wp wc update --network

    • This reply was modified 5 years, 9 months ago by ihsanberahim.
    Plugin Support Ryan Ray, a11n

    (@ryanr14)

    Hi all,

    It looks like at this point any database issues have been mostly solved, or at least a way found to get the look-up tables and more populating. I’ll mark it solved for the time being, but please do create any new threads needed if we can help further. Thanks!

    This breaks our website. wc_get_product_id_by_sku returns 0 with sku added using update_post_meta($post_id, '_sku', $product_data['sku']);

    Is there any new way to add sku other than update_post_meta? Thanks in advance.

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