Home › Forums › WoodMart support forum › Related Products: Sold Out Products at Bottom of Page
Related Products: Sold Out Products at Bottom of Page
- This topic has 9 replies, 2 voices, and was last updated 1 year, 8 months ago by
Luke Nielsen.
-
AuthorPosts
-
January 12, 2024 at 6:08 am #529168
mohaxsParticipantHello…
1. I prefer to put sold outs products at bottom of page rather than complete hiding the sold out products at entire the shop. I use code below in functions.php and working perfectly at shop page, category, and brand or tag archive. But still appear in the “Related Products”. Can you give some code to hide it in the related products?
It will be amazing if you can implement it into the theme setting directly in the next update.
if (in_array('woocommerce/woocommerce.php', apply_filters('active_plugins', get_option('active_plugins')))) { add_filter('posts_clauses', 'order_by_stock_status', 2000); } function order_by_stock_status($posts_clauses) { global $wpdb; if (is_woocommerce() && (is_shop() || is_product_category() || is_product_tag())) { $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; }
2. How to configure Related Product? For example show by tag or categories. I don’t see configuration in the theme setting, just on or off option there.
You can see my shop at private area. Thank you
January 12, 2024 at 12:37 pm #529272
Luke NielsenKeymasterHello,
1. I suggest you use our Layouts for product page, there is an option that gives the ability to hide out-of-stock products without any additional custom code. https://prnt.sc/X4w9DDgr97D6
2. In general, the “Related Products” comes from WooCommerce so we have an option just for disabling/enabling it.
Kind Regards
January 12, 2024 at 2:27 pm #529332
mohaxsParticipantI was do it in my front page Ajax Products Tabs. Any guide to import prebuilt layout? Not from scratch even it done by drag and drop. I don’t see import options from layouts admin bar.
January 12, 2024 at 3:07 pm #529342
Luke NielsenKeymasterHello,
Here is a video with more details on how to set the prebuilt layout: https://gyazo.com/e5387fb78879e53b6e4ed7ce79fd12f7
In the meantime, feel free to ask me any questions you may have.
Kind Regards
January 12, 2024 at 3:27 pm #529346
mohaxsParticipantI’ve try so many times but still goes to blank canvas page. Am I missing something or some Woodmart setting? Or it’s normal?
https://drive.google.com/file/d/1Re2_Ha15IjXi9twbJZklbUGb3aZ9T_GI/view?usp=sharing
January 12, 2024 at 3:36 pm #529352
Luke NielsenKeymasterHello,
It’s weird. Please send me access to the admin dashboard so I can check it on your side.
Thank you in advance.
Kind Regards
January 12, 2024 at 3:49 pm #529366
mohaxsParticipantAccess in private content. One more, If it’s work, that’s mean I can change shop page using the template without losing any data right? I mean it’s doesn’t same with import prebuilt website.
Thank you.January 15, 2024 at 10:29 am #529745
Luke NielsenKeymasterHello,
I see that you have some additional code in functions.php file in your child theme so pleasetry to enable the parent theme and import the content again.
The data should be saved, at any time you can disable layouts (https://prnt.sc/_t60HS8jEDjs) thus the default archive/product pages will be enabled.
Kind Regards
January 15, 2024 at 11:28 am #529788
mohaxsParticipantThank you for your assistance… It’s work. You can mark it solved!
January 15, 2024 at 1:01 pm #529851
Luke NielsenKeymasterHello,
You are welcome! In case you need any additional help, I’d be more than happy to assist you.
Wish you all the best.
Kind Regards
-
AuthorPosts
The topic ‘Related Products: Sold Out Products at Bottom of Page’ is closed to new replies.
- You must be logged in to create new topics. Login / Register