Sergei Izzi
Sergei Izzi

Reputation: 1

WoocCommerce - How to force update all products after import

I recently imported large number of products into WordPress with new prices. All works fine, except price is imported. Price changed only on 1 language, until I click on every product "update" button. I have 20k products and this is not a solution...

How to automatically update all of my products 1 by 1 (because server cannot handle too big requests).

Upvotes: 0

Views: 4299

Answers (1)

mujuonly
mujuonly

Reputation: 11841

// reset transients for products
if (function_exists('wc_delete_product_transients')) {
    wc_delete_product_transients();
} else {
    global $woocommerce;
    $woocommerce->clear_product_transients();
}

To make this automatic - Try adding this code to run once your import is over. ( Either adding once to functions.php or any plugin )

For WP All import, it seems There is no action/filter after import. Try this work around

function fn_woocommerce_delete_product_transients($post_id) {

    $product_object = new WC_Product($post_id);
    $product_object->save();
}

add_action('woocommerce_delete_product_transients', 'fn_woocommerce_delete_product_transients', 10, 1);

You may try this WooCommerce import export plugin as well

Upvotes: 1

Related Questions