Display scheduled products in Course theme to take advantage of the benefits of sorting by date

This topic has 2 replies, 2 voices, and was last updated 2 weeks ago ago by Luca Rossi

  • Avatar: Graziano
    Graziano
    Participant
    May 2, 2024 at 14:22

    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’));
    }
    }

    Please, contact administrator
    for this information.
    Files is visible for topic creator and
    support staff only.
    1 Answer
    Avatar: Justin
    Luca Rossi
    Support staff
    May 3, 2024 at 05:08

    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

  • Viewing 2 results - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.Log in/Sign up

We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.