Moderator
t-p
(@t-p)
Looks like you are using woocommerce.
If so, I recommend asking at https://wordpress.org/support/plugin/woocommerce so the plugin’s developers and support community can help you with this.
Sorry, I did not realize. My intention was to write it in the WooCommerce forum. I am so sorry.
@tp;
Now when I publish it in the other site it tells me that the ticket is duplicated. What I can do?
Try this function in your functions.php file
function custom_pre_get_posts_query( $q ) {
if(current_user_can('guest') || current_user_can('customer')){
$post__not_in = (array) $q->get( 'post__not_in' );
$post__not_in = array(27721); //Products IDS to hide
$q->set( 'post__not_in', $post__not_in );
}
}
add_action( 'woocommerce_product_query', 'custom_pre_get_posts_query' );
Omar, thanks for the answer but it seems that it has not worked. Did I have to add something to the code or just paste it into functions.php?
Moderator
t-p
(@t-p)
Okay. let me close this one then