Skip to content

Instantly share code, notes, and snippets.

@hakikz
Last active December 28, 2021 11:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hakikz/c5e8a8814c1f55df02a7a493d1468634 to your computer and use it in GitHub Desktop.
Save hakikz/c5e8a8814c1f55df02a7a493d1468634 to your computer and use it in GitHub Desktop.
Serialize Gallery Thumbnail for Additional Variation Images Gallery for WooCommerce
if ( class_exists( 'Woo_Variation_Gallery' ) ):
function wvg_serialize_support(){
$columns = absint( get_option( 'woo_variation_gallery_thumbnails_columns', apply_filters( 'woo_variation_gallery_default_thumbnails_columns', 4 ) ) );
$thumbnail_js_options = array(
'slidesToShow' => $columns,
'slidesToScroll' => $columns,
'focusOnSelect' => true,
// 'dots'=>true,
'arrows' => wc_string_to_bool( get_option( 'woo_variation_gallery_thumbnail_arrow', 'yes' ) ),
'asNavFor' => '.woo-variation-gallery-slider',
'centerMode' => false,
'infinite' => true,
'centerPadding' => '0px',
'rtl' => is_rtl(),
'prevArrow' => '<i class="wvg-thumbnail-prev-arrow dashicons dashicons-arrow-left-alt2"></i>',
'nextArrow' => '<i class="wvg-thumbnail-next-arrow dashicons dashicons-arrow-right-alt2"></i>',
'responsive' => array(
array(
'breakpoint' => 768,
'settings' => array(
'vertical' => false
),
),
array(
'breakpoint' => 480,
'settings' => array(
'vertical' => false
),
)
)
);
return $thumbnail_js_options;
}
add_filter('woo_variation_gallery_thumbnail_slider_js_options', 'wvg_serialize_support');
endif;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment