Over the past few weeks, we have been meeting with the community in the #upgrade-party Slack channel, providing support to extension developers in the community who are upgrading their extensions to be compatible with the new High-Performance Order Storage (HPOS).
We’ve collected some of the questions which have come up in the V1 edition of the HPOS Upgrade Party in hopes that it will help others who may encounter similar issues.
If you are in the process of upgrading and don’t see your question answered here, we’d love to help you get ready for HPOS on October 17thโ18th between 6:00 and 20:00 UTC in the #upgrade-party Slack channel. Find out more in the official Upgrade Party V2 Invite
Q. Are any code changes required where a custom taxonomy has been registered against the shop_order post type?
A. No, not for existing orders. However, for new orders, we insert a placeholder row in the posts’ table with post_type
set to shop_order_placehold
. If you check post_type
directly, you may need to modify it.
Q. What is the recommendation for dealing with wpdb queries where joins happen to the posts/post meta tables?
A. If you are joining custom metadata, then using WC_Query with meta_query
param will handle both data storage types. If you are joining a meta_key, which is now migrated to a proper column in the HPOS, then you should be able to use a field_query
param with the same property as a meta_query
. We plan to backport this to CPT so that the same query works for both tables.
Q. When looping through lots of orders and updating meta is there a way to update some meta without needing the full $order object?
A. You can get all the orders in one go using wc_get_orders
and then use the returned order objects to loop over. `wc_get_orders` uses very few queries to fetch in bulk, so it should be fast.
Q. Marketplace plugins are using post_author to assign the vendor to the order. Will there be a need to create a lookup table?
A. It would depend on how that field is being accessed. It could continue to work as before if they are using WordPress APIs directly, as it would work around the fact that itโs not included in the default Order fields. As we still create the placeholder post in the posts table, extension will have a place where to store the data. However, we might add this field to the Orders database if there will be a strong need for it.
Q. Will users get the updates of extensions like WooCommerce Stripe Payment Gateway & WooCommerce Subscriptions to support HPOS?
A. Yes, both of these plugins are under active development to support HPOS.
Q. My existing orders donโt seem to be automatically syncing. Whatโs wrong?
A. Try clicking on the Save Changes button. That should trigger the sync again. Ensure you have checked the โKeep the posts table and the orders table synchronizedโ checkbox.
Q. All of my interactions with order data happen through the CRUD. Will everything continue working as expected?
A. If all interactions with order data happen through CRUD, then everything should work as expected, and you shouldn’t need to change anything.
Q. Which hooks and filters are available in the new HPOS?
A. We are using the same WP_List_Table
class that custom post types use to render all order admin screens. This means that all hooks and filters that were available in the posts screen are available with HPOS, however, the screen_id
have changed. For example, if you have been using manage_shop_order_posts_columns
, you can use manage_woocommerce_page_wc-orders_columns
. The parameters passed will remain the same, but wherever you have been getting a post object, you will get an order object instead.
Similarly, you would need to replace the screen_id
for all hooks and filters from shop_order_posts
to woocommerce_page_wc-orders
.
Q. The WooCommerce FeaturesUtil::declare_compatibility is not available in the latest, public WooCommerce release. If I build this check into my plugin, what type of check do you recommend before calling that function?
A. For the moment, you may use the class_exists
check like this. You will be able to remove it once the minimum supported WC version for your plugin goes above 7.1.
Leave a Reply