Conflict with WooCommerce – FIXED
-
This plugin has a critical conflict with WooCommerce’s administrative order sorting in the WooCommerce->Order page. I’ve fixed it and thought I would share with everyone in case it hasn’t been addressed or someone else needs the fix and doesn’t go through the same amount of time I did to fix it.
Post Types Order doesn’t allow order inside WooCommerce to be sorted by their filterable columns (orderby and order essentially don’t work because the system is looking for it to be Re-Ordered, but it provides no option for it on the sidebar, nor does it essentially serve any purpose for orders themselves to be re-ordered in that fashion).
Inside the plugin’s core files, the /plugins/post-types-order/post-types-order.php file in particular, on line 85 add this line of code below the two preceding if statements:
if (isset($query->query_vars['post_type']) && ((is_array($query->query_vars['post_type']) && in_array("topic", $query->query_vars['post_type'])) || ($query->query_vars['post_type'] == "shop_order"))) return $orderBy;
This will allow WooCommerce’s order sorting to continue as normal.
If you’d also like to disable Post Types Order from working on WooCommerce’s product sorting, add this in below the aforementioned code addition:
if (isset($query->query_vars['post_type']) && ((is_array($query->query_vars['post_type']) && in_array("topic", $query->query_vars['post_type'])) || ($query->query_vars['post_type'] == "products"))) return $orderBy;
nsp_code, I’d like to suggest you make this a selectable setting somewhere alongside the plugin, as e-commerce users who use your plugin will need the ability to enable/disable this functionality without doing it inside the core files. You have it set to ignore bbPress already, so ignoring WooCommerce seems acceptable as well.
Thanks!
- The topic ‘Conflict with WooCommerce – FIXED’ is closed to new replies.