We’re looking for the best way to trigger an Algolia reindex automatically when an order is placed on WooCommerce. Currently, we have to manually use the Re-index button (as shown in the attached screenshot), but with large order volumes, this isn’t feasible.
Our plan is to create a cron job in WordPress to reindex and sync stock levels and other product metadata at a specified interval. Could you advise on the best approach to ensure updates are properly indexed?
I know we have that type of “order completed” watching in our WP Search with Algolia Pro premium addon, but also unsure about budgets for you. In it we listen to the woocommerce_order_status_completed WooCommerce hook and re-index each product from the order.
To clarify, we have a third-party integration that updates our WooCommerce product inventory from Salesforce. Since these updates occur frequently, we are experiencing issues where product stock statuses are not syncing correctly with Algolia. For example, some products that are back in stock remain marked as out of stock in Algolia, and vice versa.
Could you provide some hooks or actions that we can use in our cron job to reindex the data every hour?
Admittedly curious why WP-CLI wouldn’t work, but if it’s a case of not having access to the server that way and/or ability to schedule cron jobs, then I do get that much.
As long as the indexing of those shared attributes are wired up properly, with the appropriate filters and the like, the re-index method shouldn’t matter and all the intended data should be getting pushed into the index.
Since you mention stock/price data, is this your own rolling of I assume WooCommerce, or are you also making use of our Pro addon as well?
Alternatively, does it work when you re-index the specific index? For example `wp algolia re-index posts_products to target just that one index.