Updated on December 19, 2019

This members-only tutorial provides the steps to replace the standard WooCommerce product gallery with a slider on single products in Oxygen.

For products that do not have a Product gallery, we shall display the featured image.

Step 1

Create/edit the Template that applies to Singular Products with Oxygen.

You may want to find this starter template useful.

If not, add a Section and inside that, Product Builder component.

Add a Code Block where you want to display the product slider.

Advanced > Size & Spacing > Width: 100%.

PHP & HTML:

This is a premium members-only content.

To view the rest of the content, please sign up for membership ($37/month or $399 one-time).

Already a member? Log in below or here.

Need help implementing a tutorial in your site or want to hire me for custom work?

HIRE ME

Find the article helpful and wish to donate?

DONATE

Comments

For adding code blocks wrap the code in three backticks. Markdown should work.
Provide a URL of your site/webpage if something is not working.

7 comments on “WooCommerce Product Slider in Oxygen”

  1. great turorial, is there a way to use this functionality only in mobile? Im ok with the presentation in desktop where i have the image gallery on the left. But for mobile display, and mobile only, i would like to use this function.
    What css or code would i need to use?
    thank you

    1. Yes.

      Replace the PHP & HTML with

      <?php
      // global $product;
      global $woocommerce;
      $product = wc_get_product( get_the_ID() );

      $attachment_ids = $product->get_gallery_attachment_ids();

      echo '<div class="flexslider"><ul class="slides"><li>';

      the_post_thumbnail( 'medium_large' );

      echo '</li>';

      if ( $attachment_ids ) {
      foreach( $attachment_ids as $attachment_id ) {
      // get the alt text of featured image.
      $alt = get_post_meta( $attachment_id, '_wp_attachment_image_alt', true );

      // if no alt text is present for featured image, set it to product title.
      if ( '' === $alt ) {
      $alt = the_title_attribute( 'echo=0' );
      }

      printf( '<li><img src="%s" alt="%s" /></li>', wp_get_attachment_url( $attachment_id ), $alt );
      }
      }

      echo '</ul></div>';
      ?>

magnifiercross
linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram
%d bloggers like this: