Tagged: woocommerce
Hi,
I am building a woocommerce catalog website.
I want the next and previous buttons to navigate to products from the same category
Hoiw can I fix it?
Thanks
Uri
Hi uribinsted!
Please take a look here
https://kriesi.at/support/topic/previousnext-buttons-on-portfolio-items-restrict-to-1-category/
let us know if we can do anything else for you.
Best regards,
Basilis
Is this possible to do within the child theme framework? I tried adding…
function avia_post_nav($same_category = true)
… to my functions.php file and it caused a fatal error. So I went back to this post and see it says to edit the “functions-enfold.php” which I assume is not the functions.php file in the child theme. Interested to know how I too can restrict Next and Previous to one category.
I’ll also add this to the functionality request, it seems unlikely anyone would want to cruise through multiple Post categories.
Thank you
Hi,
Please add this code in the functions.php file:
add_filter('avia_post_nav_settings', 'avia_post_nav_settings_mod');
function avia_post_nav_settings_mod($settings)
{
if(is_singular('product')) {
$settings['taxonomy'] = 'product_cat';
$settings['is_fullwidth'] = false;
}
$settings['same_category'] = true;
return $settings;
}
Best regards,
Ismael
Awesome, this seems to be working! Thx
Hi,
Glad we could help :)
Best regards,
Nikko
Hi,
I copied Ismaels code to my functions.php (child theme) but nothing happens :’ (
Maybe the filter was modified after January? Can you give me an updated code snipped?
I’m using enfold 4.1.2, woocommerce 3.1.2
Hi tl_s180,
The filter has not changed. The code should be working. Can you give us temporary admin access to your website in the private content box below, so that we can have a closer look?
Best regards,
Victoria
Thanks for your response. I figured out it’s working actually.
Most of my products are in multiple categories.
I made some test products with one category only .. and here it’s working as intended.
I guess it’s not possible to navigate to the next product of the current category, if a product is assigned to multiple categories.
Hi,
You are right!
happy you solve it.
Please feel free to let us know if there is anything else we can do for you.
Thank you
Best regards,
Basilis