- This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
Viewing 2 posts - 1 through 2 (of 2 total)
- You must be logged in to reply to this topic.
› Forums › WordPress/WooCommerce › How to Sort Related Products by Popularity (Sales)?
WooCommerce provides several hooks that allow you to customize the related products section, can WooCommerce Upsell Order Bump sort related products by popularity (Sales)?
Related Products” section is a common feature that displays products that are related to the current product being viewed.
This section is typically found on single product pages and is designed to encourage customers to explore additional products that might interest them.
WooCommerce provides several hooks that allow you to customize the related products section.
To achieve this, you need to modify the query that fetches related products using the woocommerce_related_products hook.
WooCommerce stores the total number of sales for each product in a custom field called total_sales.
By sorting the related products query by this field, you can display the most popular products first.
To sort related products by popularity, you need to:
Then, also you need to edit the PHP code yourself which is not a recommended method.
Luckily you can sort these Upsell and Cross Sell Related Products without changing a line of code, just use the WooCommerce Upsell Plugin by WP Swings which has various features to sort the related products as per your need.