Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter daymobrew

    (@daymobrew)

    I noticed that when I put the file_list field in another meta box (one from the other support thread [though it is not in the linked file]) that it works. I’ll keep looking into this strangeness.

    Thread Starter daymobrew

    (@daymobrew)

    It’s also strange that when debugging in VSC I added breakpoints at the top of CMB2_Woo_Orders_Hookup::hooks(), get_order_meta(), update_order_meta() and save_order_meta_changes(). These work on my ‘other‘ code but not on the attach-order-files-to-wc-order-email.php code (VSC marks them as Unverified Breakpoints!).

    I even modified the latter code to change from a PHP class to straight functional code (like the working file) but no joy.

    Thread Starter daymobrew

    (@daymobrew)

    I think I’ve figured out the issue:

    If object_types is shop_order and woocommerce_page_wc-orders then it will not work.

    'object_types' ?=> array( 'shop_order', 'woocommerce_page_wc-orders' ),

    If it is only woocommerce_page_wc-orders then it works fine.

    'object_types' ?=> array( 'woocommerce_page_wc-orders' ),

    Maybe I can check whether HPOS is active and set the object_types list appropriately.

    Thread Starter daymobrew

    (@daymobrew)

    I have changed the new_cmb2_box() code:

    $woo_hpos_active = get_option( 'woocommerce_custom_orders_table_enabled' );
    $object_types = ( 'yes' == $woo_hpos_active ) ? array( 'woocommerce_page_wc-orders' ) : array( 'shop_order' );
    
    $cmb = new_cmb2_box( array(
        ...
        'object_types'  => $object_types,
        ...
    );

    • This reply was modified 1 year, 2 months ago by daymobrew.
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘file_list data not stored when WooCommerce HPOS active’ is closed to new replies.