fix: WooCommerce product types not appearing in selector

Fixed timing issue where WooCommerce integration hooks were registered
too late during plugins_loaded. The constructor now calls check_woocommerce()
directly instead of hooking it at priority 5 (which had already passed).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-28 23:47:56 +01:00
parent 01c256349f
commit 96269eb355
5 changed files with 26 additions and 7 deletions

View File

@@ -28,8 +28,16 @@ class Integration {
* Constructor.
*/
public function __construct() {
add_action( 'plugins_loaded', array( $this, 'check_woocommerce' ), 5 );
add_action( 'plugins_loaded', array( $this, 'init' ), 20 );
// Check WooCommerce immediately since we're instantiated during plugins_loaded.
$this->check_woocommerce();
// If plugins_loaded hasn't fully completed, hook init at priority 20.
// Otherwise, run init directly.
if ( ! did_action( 'plugins_loaded' ) || doing_action( 'plugins_loaded' ) ) {
add_action( 'plugins_loaded', array( $this, 'init' ), 20 );
} else {
$this->init();
}
}
/**