Install
This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.
Install straight from GitHub with WP-CLI:
wp plugin install https://github.com/cmb2/cmb2-woocommerce-hpos-orders/archive/refs/heads/main.zipNo built-in updater. New versions won't appear under Dashboard → Updates. Install new releases yourself, or let Git Updater track the repository.
Custom field for CMB2.
Adds the ability to add custom fields to the new WooCommerce HPOS orders page.
Installation
Follow the example in example-field-setup.php for a demonstration. The example assumes you have both CMB2 and this extension in your mu-plugins directory. If you're using CMB2 installed as a plugin, you can remove the require_once line.
Usage
You can retrieve the meta data using the following:
$test_text_value = wc_get_order( $order_id )->get_meta( 'yourprefix_woo_orders_text', true, 'edit' );
Changelog
1.0.1
- Bugfix: Gate the
cmb2_override_meta_*filters to the orders object type so they no longer run for unrelated CMB2 fields (posts, pages, users, etc.), which caused a fatalCall to undefined function wc_get_order()when WooCommerce was inactive. - Guard
wc_get_order()withfunction_exists()since this loads as an mu-plugin regardless of whether WooCommerce is active.
1.0.0
- Release