How to add navigation controls to the WooCommerce product gallery slider 2024

In this guide I will show you how to add navigation controls to the WooCommerce product gallery slider. The left and right arrows, just in case you are wondering. This is particularly helpful for themes which don’t support navigation controls. Navigation controls give your visitors more ways to browse between products, and gives you an opportunity to make other changes, such as removing the thumbnails below the gallery.

This guide involves only two steps. The first step is some custom PHP code in your theme functions.php file and the second is some custom CSS in your theme customiser >> additional CSS.

First, add some custom PHP code to your theme functions.php file of your child theme. This will add the navigation HTML to the gallery, but it will be an unstyled list.

/*
 * Snippet: How to add navigation controls to the WooCommerce product gallery slider 2024
* Author: John Cook
* URL: https://wcsuccessacademy.com/?789
* Tested with WooCommerce 8.8.2
*/ add_filter( 'woocommerce_single_product_carousel_options', 'wcsuccess_woo_flexslider_navigation' ); function wcsuccess_woo_flexslider_navigation( $options ) { $options['directionNav'] = true; return $options; }

Next add the following CSS to your theme customiser >> additional CSS. This will style the navigation into nice and usable buttons. You will notice that we are using native chevron arrows. If you prefer you may use either Dashicons or Fontawesome. Native chevron arrows were used in case Dashicons are disabled on the frontend and you prefer not to add an additional library to your website. Modify the CSS to suit your own design preferences.

/**
  * Snippet: How to add navigation controls to the WooCommerce product gallery slider 2024
* Author: John Cook
* URL: https://wcsuccessacademy.com/?789
* Tested with WooCommerce 8.8.2
* "Nav control css"
*/ ul.flex-direction-nav { position: absolute; top: 30%; z-index: 99999; width: 100%; left: 0; margin: 0; padding: 0px; list-style: none;} li.flex-nav-prev { float: left; } li.flex-nav-next { float: right; } a.flex-next { visibility:hidden; } a.flex-prev { visibility:hidden; } a.flex-next::after { visibility:visible; content: "\2771"; margin-right: 10px; font-size: 20px; font-weight: bold; } a.flex-prev::before { visibility:visible; content: '\2770'; margin-left: 10px; font-size: 20px; font-weight: bold; } ul.flex-direction-nav li a { color: #ccc; text-decoration:none; } ul.flex-direction-nav li a:hover { text-decoration: none; }

When it’s done you should see two navigation arrows on your gallery similar to below

0 0 votes
Article Rating

Stay In Touch

Was this post helpful? Why not show your support and buy me a coffee?

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x
Scroll to Top
×