Product imports can leave wholesale visibility data out of date because imported products are not always saved through the normal WooCommerce workflow. You can use WP All Import with WooCommerce Wholesale Prices Premium to run the supported visibility rebuild automatically after each import.
Requirements
- WooCommerce Wholesale Prices Premium version 2.1.1 or later
- WP All Import installed and configured for your product import
- A child theme or a code snippets plugin where you can safely add PHP
- A recent site and database backup, plus a test or staging import where possible
Version 2.1.1 and later process catalog-scale visibility cleanup and rebuilding in smaller batches. Older versions used larger database operations that could lock the database and make a busy or large store unavailable for several minutes when this routine ran automatically after every import.
Step 1: Add the snippet
Add this snippet to your child theme’s functions.php file or to a code snippets plugin:
function wwpp_reinitialize_visibility_after_import() {
// Fire Wholesale Prices Premium's supported trigger for the
// "Re-Initialize Product Visibility Meta" routine.
do_action( 'wwp_trigger_initialize_product_visibility_meta' );
}
add_action( 'pmxi_after_xml_import', 'wwpp_reinitialize_visibility_after_import' );
pmxi_after_xml_import runs after a WP All Import job finishes. The snippet then triggers the same Re-Initialize Product Visibility Meta routine available from the Help tab in Wholesale Prices settings.
Step 2: Run a test import
- Run a small test import that updates a few products.
- Wait for the import and visibility rebuild to finish. The hook runs synchronously after the import; it is not a background job.
- Check the imported products as a retail customer and each relevant wholesale role.
- Confirm that products appear or stay hidden according to their assigned wholesale visibility.
For the manual recovery workflow and additional checks, see How To Fix Broken Product Visibility After Product Importing.
Troubleshooting
The import or site hangs after the import finishes. Confirm that WooCommerce Wholesale Prices Premium is version 2.1.1 or later. Disable the automatic snippet while updating from an older release, then test again with a small import.
A very large catalog still takes a long time. Current versions reduce long database locks, but the work still runs immediately after the import and must process the affected catalog. Test during a low-traffic period and contact support if the routine does not complete on a current version.
You use a different import plugin. Run the same do_action( 'wwp_trigger_initialize_product_visibility_meta' ); call from the action that plugin fires after its import finishes. Ask the plugin author or a developer for the correct completion hook.
Need help?
If you have a question or run into any issues, we’re here to help.
- Premium users: Open a support ticket
- Free users: Visit our community forum
