MB Custom Table & WooCommerce

Support MB Custom Table MB Custom Table & WooCommerceResolved

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #14896
    BrianBrian
    Participant

    Hi Anh,
    I was reading the docs on MB Custom Table. You give the example of how WooCommerce creates 40 custom fields for one order. And how the MB Custom Table would bring all this into 1 column.

    Can we actually do this with WooCommerce & the MB Custom Table or was this just a hypothetical example? I would really like to move all Woo fields into a custom MB Table like in your example.

    Is this currently possible? As it's an excellent idea.

    Thanks in advance.

    #14905
    Anh TranAnh Tran
    Keymaster

    Hi Brian,

    Can we actually do this with WooCommerce & the MB Custom Table or was this just a hypothetical example?

    I'm afraid we can't. This involves a lot of the internal logic in WooCommerce. Modifying the data will break the logic and make it not working.

    #35769
    izaakbeer.nlizaakbeer.nl
    Participant

    @Anh Tran I've just stumbled across the example that is given: https://metabox.io/plugins/mb-custom-table/.

    The amount of rows added for one order is worrisome, so I was thinking of using MB Tables to reduce the number of rows required -- just like your example states.

    From your response here, I understand it's not even possible to achieve this with MetaBox? If yes, why is it even presented as an example?

    If it is possible, could you please provide an example?

    Thank you!

    #35774
    Long NguyenLong Nguyen
    Moderator

    Hi,

    You can save the product data (field value) to the custom table but WooCommerce has its own procedure to save its own data to the database and display it on the frontend. For example, WooCommerce saves the product meta SKU, Price, Stock Quantity ... to the table wc_product_meta_lookup

    So if you want to do that, you need to create a lot of custom code to save it to your own custom table.

    Here are some guides for you
    https://www.mootpoint.org/blog/woocommerce-hook-product-updated-added/
    https://wordpress.stackexchange.com/questions/334407/get-woocommerce-product-details-and-transfer-them-to-a-custom-db-table

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.