- This topic has 25 replies, 5 voices, and was last updated 3 years, 6 months ago by
David.
-
AuthorPosts
-
July 31, 2018 at 4:37 am #636836
Alberto
Hi!
I would like to know if there is any way to place “previous” and “following” buttons on the Woocommnerce product pages, so that you can navigate from one product to another without having to return to the product category page.
Thank you in advance.
July 31, 2018 at 6:18 am #636901David
StaffCustomer SupportHi there,
You can try this how to:
https://businessbloomer.com/woocommerce-add-nextprevious-single-product-page/
July 31, 2018 at 6:42 am #636920Alberto
Hello David! Thank you very much for your reply.
I would appreciate it if you could indicate where I should place those codes within Generatepress.
Thank you very much!
July 31, 2018 at 6:47 am #636924David
StaffCustomer SupportSo the first code is PHP:
https://docs.generatepress.com/article/adding-php/
If you’re not using a Child theme i would suggest the Code Snippets plugin, a link to which is in the above articleSecond is CSS:
https://docs.generatepress.com/article/adding-css/July 31, 2018 at 8:40 am #637055Alberto
David.
I have placed the php code using the Code Snippets plugin. I also placed the additional CSS from Customize> Additional CSS, however the previous and next arrows do not appear on the Woocommerce product page …
I think I followed the steps correctly …
I have to win something more from Generapress?
Thank you in advance.
July 31, 2018 at 9:07 am #637084David
StaffCustomer SupportAah ok, that code works by skipping through the Product Categories, which it looks like your products don’t have any?
Try adding a base category to some of the products and see if that works.
July 31, 2018 at 9:29 am #637101Alberto
All the products belong to a category (you can see it from the accordion menu on the right). I have the breadcrumb disabled from Generatepress, although activating it does not make any difference either …
July 31, 2018 at 4:56 pm #637361Tom
Lead DeveloperLead DeveloperThat’s weird.
In your PHP code, find this line:
echo $previous;On the line above it, do this:
var_dump($previous);So it should look like this:
var_dump($previous); echo $previous;That will output some debugging data where the links should show up. Can you share that data with me?
July 31, 2018 at 5:06 pm #637372Alberto
Hello Tom.
After placing the code, it now appears, on the left side NULL
July 31, 2018 at 5:30 pm #637396Tom
Lead DeveloperLead DeveloperWeird, so that core WP function isn’t working..
Try this:
add_action( 'woocommerce_before_single_product_summary', 'tu_prev_next_product' ); function tu_prev_next_product(){ echo '<div class="prev_next_buttons">'; next_post_link( '%link', '← Previous', true, false, 'product_cat' ); previous_post_link( '%link', 'Next →', true, false, 'product_cat' ); echo '</div>'; }August 1, 2018 at 3:36 am #637612Alberto
Hello, good morning Tom.
I changed the code I had for this one that you passed me and the previous and next arrows still do not show …
I no longer know what the error may be.
Thank you very much for your help.
August 1, 2018 at 4:31 pm #638201Tom
Lead DeveloperLead DeveloperJust made a small change, can you give it another shot?: https://generatepress.com/forums/topic/previous-and-next-buttons-in-woocommerce/#post-637396
August 1, 2018 at 4:50 pm #638204Alberto
Tom.
Unfortunately, it still does not work
August 1, 2018 at 7:54 pm #638286Tom
Lead DeveloperLead DeveloperHmm, this has me stumped! Let me do some testing – I’ll get back to you.
August 2, 2018 at 3:17 am #638497Alberto
Ok, thank you very much and I await your response.
-
AuthorPosts
- You must be logged in to reply to this topic.