This topic has 11 replies, 3 voices, and was last updated 2 years, 3 months ago ago by Rose Tyler
Hi Team,
I want the following changes in related products.
1. Related products should show Random Products
2. Want another related products that show related products using Attribute – Color. For e.g., Current product is Color – Yellow, so related should show same category yellow color products
Both these functions were available in my previous theme. I used to show 48 Related Products by Color and 48 Random Related Products. But I am not able to make those changes in this theme.
Kindly help me or let me know how to make these changes.
Thanks
Hello,
Related Products is a section that pulls products from your store that share the same tags or categories as the current product https://woocommerce.com/document/related-products-up-sells-and-cross-sells/#section-3
So, if you want to change products that display there you can implement this by additional customization only. You can submit customization request here.
Regards
I just want to display related products in random order
Hello,
Try to contact the support of WooCommerce plugin.
Please note that additional customization is outside the scope of our basic support.
Regards
Why so vague answer?
How come this customization is outside the scope of your basic support.
You are showing related products in ASC order. I am saying to change it to RAND.
Just this much work and you are saying its out of basic support.
My previous theme has this feature inbuilt, yours dosen’t have.
If this is your support then its worst. Believe it.
Regretting purchasing this theme. Would like to get my money back instead of wasting time here.
Thanks
Hello,
We’ve checked more deeply, Related products are displayed in our theme randomly, by default. But on your site it is not, so check if you did any changes in files that may affect it, for example changes in xstore-child/woocommerce/single-product/related.php, or maybe something from 3rd party plugins affects related products.
You can try to add the next code in functions.php of the child theme:
add_filter('woocommerce_related_products_args', function($args) {
$args['orderby'] = 'rand';
return $args;
}, 9999);
If you need any further assistance with this, provide temporary wp-admin and FTP access, so we can take a closer look.
Regards
This code is already added but still not working, sharing site access
Hello,
https://prnt.sc/goVdRvI5oC_E – first load
https://prnt.sc/_Sbq3nhp-MK_ – the same product after refresh, page shows other products randomly
Please clear cache and check one more time, provide URL of product where it doesn’t work correctly.
Regards
https://k***eals.com/product/men-cargo-grey/?swcfpc=1 – when URL is like this all is fine. This parameter comes from Super Page Cache for Cloudflare plugin on your site.
Please follow our previous recommendations: Try to disable all the third-party plugins (including cache plugins), that do not come bundled with XStore https://www.8theme.com/documentation/xstore/plugins/included-plugins/ , clear the cache of the browser and CDN cache, and check then.
Regards
I am using the following code in child function.php but it is not working:
add_filter(‘woocommerce_related_products_args’, function($args) {
$args[‘orderby’] = ‘title’;
$args[‘order’] = ‘ASC’;
return $args;
}, 9999);
Please help,
Thanks
Hello,
Please note that we are not responsible for custom changes that you do in the child theme.
1/ your admin access is out of working state
2/ the code we sent you above is different from the one you sent in last topic. Do you want to show them in rand order or sorted by title because there is only one param that could show either by title or by rand ?
our code:
add_filter('woocommerce_related_products_args', function($args) {
$args['orderby'] = 'rand';
return $args;
}, 9999);
your code:
add_filter(‘woocommerce_related_products_args’, function($args) {
$args[‘orderby’] = ‘title’;
$args[‘order’] = ‘ASC’;
return $args;
}, 9999);
Regards
You must be logged in to reply to this topic.Log in/Sign up