Following my Woocommerce site's data migration to a new hosting provider, I seem to have a few issues with my product - seems like a potential issue with the database. To fix it, I simply have to open the Product and click Update without making any changes seems to fix the issue. I have tried the BULK Edit option and siply clicking Save, but that does not help and requires me to open each products using Edit and then Update.
I tried the following script found on another post but that did not help either.
add_action( 'woocommerce_loaded', 'update_products_by_x' );
function update_products_by_x(){
$limit = 200;
// getting all products
$products_ids = get_posts( array(
'post_type' => 'product','product_variation',
'numberposts' => $limit,
'post_status' => 'publish',
'fields' => 'ids',
'meta_query' => array( array(
'key' => '_sync_updated',
'compare' => 'NOT EXISTS',
) )
) );
// Loop through product Ids
foreach ( $products_ids as $product_id ) {
// Get the WC_Product object
$product = wc_get_product($product_id);
// Mark product as updated
$product->update_meta_data( '_sync_updated', true );
$product->save();
}
}
After Exporting the products into a CSV file - which has products which have been fixed and some which haven't been fixed, I see the following:
Meta: _a3_pvc_activated - Fixed shows FALSE and Not Fixed shows <blank> Meta: _monsterinsights_sitenote_active - Fixed shows 0 and NOT Fixed shows <blank> Meta: _wpas_skip_publicize_24800780 - Fixed shows 1 and NOT Fixed shows <blank> Meta: _wpas_skip_publicize_25101066 - Fixed shows 1 and NOT Fixed shows <blank>
There may be other issues like linking the product to the database, but one of the ways to see which products are working and which not, have a look at the following search link
https://crawleycoins.co.uk/?product_cat=1-circulated&s=&post_type=product
Only 4 products are listed, but on the right, you can see that this category has 12 products. One workarond for seach is to simply remove &s= and then u can see all 12 of them so they are certainly categorised correctly but something is just not linked up correctly and I cannot seem to find a way to fix this.
Turbo Multi-language Translator
Make the better internet purchasing globaly
Turbosify SEO Speed Booster
5.0 (7)•Free plan available
Get better conversions by improving store loading speed
Installed
Turbo Multi-language Chat - AI Customer service in one hand