This topic has 2 replies, 2 voices, and was last updated 2 weeks ago ago by Luca Rossi
Hallo, I hope you can help me with this question!
I’m using Xstore to sell courses; I would like to use publish data as the course data in order to take benefit to data course sorting.
I achieved it by using the following rule in the function.php but it works only if I am logged in as admin. I would like it to work also in public view (no-loggedin), I tried to modify the script without any results…maybe you can help me or you can put me in the right way, it will be very helpfull.
I’ve attached an imag to better show
Thanks in advance
Graz
Shop page https://sviluppomanageriale.it/develop13/shop/
add_action(‘woocommerce_product_query’, ‘show_future_products’, 999);
function show_future_products($q)
{
if ( ! is_admin() && ! is_user_logged_in() ) {
$q->set(‘post_status’, array(‘publish’, ‘future’));
}
}
Hi @Graziano,
Please try with the following codes:
add_filter('woocommerce_products_widget_query_args', 'n2t_woocommerce_products_widget_query_args', 999);
function n2t_woocommerce_products_widget_query_args($query_args){
$query_args['post_status'] = ['publish', 'future'];
return $query_args;
}
The customization codes would be outside of scope our support standard.
Should you require any additional customizations for your website, please feel free to submit a request through our customization panel at [8Theme Customization Panel](https://www.8theme.com/account/#etheme_customization_panel).
Thank you for choosing us for your website needs. Should you have any further questions or require assistance, please do not hesitate to contact us.
Best Regards,
8Theme’s Team
You must be logged in to reply to this topic.Log in/Sign up