List of WooCommerce Products shorted as per the date Modified.

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

  • Avatar: Vijith
    Vijith
    Participant
    September 17, 2024 at 10:27

    Hi,
    How can I have the list of Woocommerce products with the sorting option “Date Modified”?

    Also, I wanted to add the date of Modification as well (Meta)

    Refer to the attached image.

    Files is visible for topic creator and
    support staff only.
    1 Answer
    Avatar: Justin
    Luca Rossi
    Support staff
    September 18, 2024 at 07:47

    Hi @Vijith,

    1. Please add the following code under functions.php file locates in your child theme:

    
    add_filter('woocommerce_get_catalog_ordering_args', 'custom_woocommerce_get_catalog_ordering_args');
    
    function custom_woocommerce_get_catalog_ordering_args($args) {
    if (isset($_GET['orderby']) && 'date_modified' == $_GET['orderby']) {
    $args['orderby'] = 'modified';
    $args['order'] = 'desc';
    }
    return $args;
    }
    
    add_filter('woocommerce_default_catalog_orderby_options', 'custom_woocommerce_add_new_orderby');
    add_filter('woocommerce_catalog_orderby', 'custom_woocommerce_add_new_orderby');
    
    function custom_woocommerce_add_new_orderby($sortby) {
    $sortby['date_modified'] = 'Date Modified';
    return $sortby;
    }
    

    2. Please provide the website URL reference to this screenshot: https://userimg.8theme.com/storage/2024/09/17/34585-Screenshot%202024-09-17%20122517.png.

    Thank you!

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

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

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