change in product status upon update
-
Good afternoon.
Earlier, I asked you how to hide products from the catalog, but leave them visible for search if they were deleted from the vendor file.
And you advised me to use this code:<?php
function my_is_post_to_delete( $is_post_to_delete, $post_id, $import ) {
// Unless you want this code to execute for every import, check the import id
// if ( $import->id == 5 ) { … }
if ( $product = wc_get_product( $post_id ) ) {
$product->set_catalog_visibility( ‘hidden’ );
$product->save();
}
return false;
}
add_filter( ‘wp_all_import_is_post_to_delete’, ‘my_is_post_to_delete’, 10, 3 );
?>It works great, thanks.
But there is one problem: When the product appears again in the vender file, the statue does not change on my site and it still remains with the status of “Hidden”Please help to solve this problem?
The page I need help with: [log in to see the link]
- The topic ‘change in product status upon update’ is closed to new replies.