Home Forums WoodMart support forum about out of stock and no price product on product listing

about out of stock and no price product on product listing

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #490379

    [email protected]
    Participant

    Dear Support

    My i ask if any setting can make the no price and out of stock product display at last in the product list ?
    Thank

    Mango

    #490528

    Hello,

    Try to remove the product price and in the inventory tab remove check the option out of stock. And you will see this product out of stock in product listings.

    Best Regards.

    #490549

    [email protected]
    Participant

    Thank for your quick reply ,
    they can showon listing , but they want to show it at the last of the listing when the product is no stock , is it possible ?

    #490715

    Hello,

    Try to add the below code to the functions.php file in your child theme.

    add_filter('posts_clauses', 'order_by_stock_status'); function order_by_stock_status($posts_clauses) { global $wpdb; // only change query on WooCommerce loops if (is_woocommerce() && (is_shop() || is_product_category() || is_product_tag() || is_product_taxonomy())) { $posts_clauses['join'] .= " INNER JOIN $wpdb->postmeta istockstatus ON ($wpdb->posts.ID = istockstatus.post_id) "; $posts_clauses['orderby'] = " istockstatus.meta_value ASC, " . $posts_clauses['orderby']; $posts_clauses['where'] = " AND istockstatus.meta_key = '_stock_status' AND istockstatus.meta_value <> '' " . $posts_clauses['where']; } return $posts_clauses; }

    Best Regards.

    #490912

    [email protected]
    Participant

    Dear support ,

    when it add to child theme, function.php . the site can’t load with wordpress serious problem warning
    Any idea what wrong with it ?

    thank
    Mango

    #491012

    Hello,

    Can you please share the WP admin login details of your site and FTP login details so I will check what is happening after add the code.

    Also, share the screenshot of the issue or warning you see after add the code in the child theme.

    Best Regards.

Viewing 6 posts - 1 through 6 (of 6 total)