1. Casa
  2. Knowledge Base
  3. WooCommerce Prezzi all'ingrosso Premium
  4. Visibilità del prodotto
  5. Come eseguire automaticamente il pulsante Reinizializza metadati visibilità dopo ogni importazione utilizzando WP All Import
  1. Casa
  2. Knowledge Base
  3. Problemi di compatibilità noti
  4. Come eseguire automaticamente il pulsante Reinizializza metadati visibilità dopo ogni importazione utilizzando WP All Import

Come eseguire automaticamente il pulsante Reinizializza metadati visibilità dopo ogni importazione utilizzando WP All Import

After importing your products using a third party plugin like WP All Import, your products are not re-saved in a traditional way like what is discussed in this article. If this happens, you just need to click the Re-initialize Product Visibility Meta on the Help tab of our Wholesale Price settings, to save the correct wholesale meta values in the database.

However, some customers update their products more often, usually via a scheduled import using a CRON job. It will be difficult for them to keep manually clicking this button each time they import their products. So the best workaround for this is to use the snippet below to automatically run the re-initialize button each time an import is made.

Please put this snippet on your theme/child theme’s functions.php:

function wwpp_product_visibility_fix() {
$wwpp = WooCommerceWholeSalePricesPremium::instance();
$wwpp_wholesale_roles = WWPP_Wholesale_Roles::instance();
$wwpp_wholesale_role_payment_gateway = WWPP_Wholesale_Role_Payment_Gateway::instance( array( 'WWPP_Wholesale_Roles' => $wwpp_wholesale_roles ) );
$wwpp_bootstrap = WWPP_Bootstrap::instance( array(
'WWPP_Wholesale_Roles' => $wwpp_wholesale_roles,
'WWPP_Wholesale_Role_Payment_Gateway' => $wwpp_wholesale_role_payment_gateway,
'WWPP_CURRENT_VERSION' => $wwpp::VERSION
) );
$wwpp_bootstrap->initialize_product_visibility_filter_meta();
}
add_action( 'pmxi_after_xml_import', 'wwpp_product_visibility_fix' );

Please note that this custom snippet is a filter for a function called ‘pmxi_after_xml_import’. It is a function from WP All Import, which means that the code should run after the importing of your products.

If you’re using other third-party plugins, we suggest contacting the plugin author or ask a developer to provide further assistance regarding this snippet.

Questo articolo è stato utile?

Articoli Correlati

Serve Supporto?

Non trovi la risposta che cerchi?
Contatta il Supporto
Completa il tuo acquisto