• Hi!

    We need to disable some plugin hooks when WC is migrating orders to HPOS and I was wondering if you have a flag of some sort (like DOING_CRON or DOING_AJAX) that we could use for this?

    Thanks in advance!

    Mike

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi @iammvc,

    Thank you for reaching out to us! I understand you’re looking for a way to detect when WooCommerce is migrating orders to High-Performance Order Storage (HPOS). WooCommerce does provide a way to check if the HPOS migration is happening. You can look for a specific action hook that’s triggered during the migration process. This hook can be used to determine when the migration is taking place and to disable other hooks accordingly. To give you the most accurate guidance, could you please provide a bit more information about your setup? Specifically:

    • Which version of WooCommerce are you currently using?
    • Are you looking to disable hooks globally or conditionally for specific orders?
    • Could you share an example of the hooks you’re trying to disable?

    In the meantime, you can find more information about HPOS and its implementation in the WooCommerce documentation here.

    Looking forward to your response to assist you further!

    Thread Starter iammvc

    (@iammvc)

    Hi @afzalpansuvi

    Thanks for getting back to me!

    We are currently testing with WooCommerce 8.8.3 and we would like to disable/skip our hooks globally during the migration/sync process.

    To give you a bit of context, our code is hooked into woocommerce_order_status_completed so for every order that gets migrated, our code is being executed a second time. We would like to be able to check for a flag (e.g. DOING_CRON) so we could unhook our code until the process completes.

    Is this possible?

    Kind regards

    Mike

    Hi Mike @iammvc,

    Helping out with custom coding of this nature is outside the scope of support that our support staff can help out with here, although I would recommend the following:

    1. Running the exact question you’re asking, along with the code provided, through an AI platform like ChatGPT for recommendations/changes to your code;
    2. Checking whether there are existing plugins in the WordPress plugin repository that might be doing that already.
    3. Joining our WooCommerce Slack community (it does have a developer channel where you can ask coding questions): https://woo.com/community-slack/

    Hope it helps!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Detecting HPOS Data Sync’ is closed to new replies.