• Resolved loopforever

    (@loopforever)


    Hello,
    What exactly does this do: wc_order_product_lookup
    Also is there a function to update it? (Ex. wc_update_order_item_meta() ).

Viewing 6 replies - 1 through 6 (of 6 total)
  • Hi @loopforever

    The wc_order_product_lookup table – is where your products data is stored (Product ID or Variation ID) product_id as the relational index (the post ID).

    It also, allows fast queries to retrieve products on orders.

    Now, to update it, I am not exactly sure what do you mean, but if you’re looking to regenerate your product table, you can do this under WooCommerce > Status > Tools > Product lookup tables > Click – Regenerate (Button on right).

    You can read more about the WooCommerce tables here: https://woocommerce.com/document/installed-database-tables/

    Let me know if you have questions! My very best,

    Thread Starter loopforever

    (@loopforever)

    Thank you for your response.
    In a project I’m working on, I do some operations after a customer orders a product. Like updating item qty. I do this in the woocommerce_order_itemmeta table. For example, after customer update item qty, I’m updating tax amount, subtotal total etc. in the background. So, I am updating all monetary amounts in this table.

    I’m wondering if I should make any changes to this table (wc_order_product_lookup) as well. If I’m going to make changes, is there a function for that? For example, I want to update the number of the product with item id 297.

    • This reply was modified 2 years, 8 months ago by loopforever.

    Hello there,

    I’ve read you are working on a project and updating some data.

    My recommendation is to do this process as simple and automated as you can. The database goal is to keep the data intact.

    I want to update the number of the product with item id 297.

    May I ask are you working directly on the database or via custom code?

    Let us know, thanks.

    Thread Starter loopforever

    (@loopforever)

    Thaknk you.
    I’m working via custom code.

    Hey @loopforever,

    This lookup table is primarily used to power the analytics data in WooCommerce. When an order is created, data is added to several different database tables.

    • _posts
    • _postmeta
    • _woocommerce_order_items
    • _woocommerce_order_itemmeta

    Once orders are created, they are imported into the lookup tables via scheduled actions.

    If you need the most reliable data, I would not use the lookup tables for this. Go with the sources of truth I mentioned above.

    Let us know if you have any questions.

    Mirko P.

    (@rainfallnixfig)

    Hi @loopforever,

    We haven’t heard from you in a while, so I’m going to mark this as resolved. Feel free to start a new thread if you have any more questions.

    Cheers.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Order Product Lookup Table’ is closed to new replies.