Fix AJAX handler timing: register directly instead of on woocommerce_loaded
The woocommerce_loaded hook may have already fired by the time our plugin initializes. Register the AJAX handler directly since we've already verified WooCommerce is active. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -130,8 +130,9 @@ final class Manager {
|
|||||||
// Declare HPOS compatibility.
|
// Declare HPOS compatibility.
|
||||||
add_action( 'before_woocommerce_init', array( self::class, 'declare_hpos_compatibility' ) );
|
add_action( 'before_woocommerce_init', array( self::class, 'declare_hpos_compatibility' ) );
|
||||||
|
|
||||||
// Always register admin AJAX handlers (for settings page).
|
// Always register admin AJAX handlers immediately (for settings page).
|
||||||
add_action( 'woocommerce_loaded', array( ProductSync::class, 'init_admin_ajax' ) );
|
// Must be called directly, not via hook, since woocommerce_loaded may have already fired.
|
||||||
|
ProductSync::init_admin_ajax();
|
||||||
|
|
||||||
// Only initialize full components if integration is enabled.
|
// Only initialize full components if integration is enabled.
|
||||||
if ( ! self::is_enabled() ) {
|
if ( ! self::is_enabled() ) {
|
||||||
|
|||||||
Reference in New Issue
Block a user