WooNoob
WooNoob

Reputation: 31

Available parameters details for WooCommerce product image zoom options

Apologies if these are very basic questions but I'm trying to understand Woocommerce hooks.

In the post below, the answer very helpfully sets out the available parameters for the hook woocommerce_single_product_zoom_options:

Adjusting product image's Zoom magnification factor in woocommerce 3

Is there a archive of all hooks and the relevant parameters? I looked on Woocommerce and could find the hook list but it didn't provide info on the parameters.

Very grateful for any help.

Upvotes: 3

Views: 1547

Answers (1)

LoicTheAztec
LoicTheAztec

Reputation: 253968

You can find all available arguments for woocommerce_single_product_zoom_options hook on jquery.zoom.js file included in the WooCommerce plugin, but they are not documented on this file. But as you can see it's a jQuery plugin, so there is some documentation:

Documentation for jQuery Zooom plugin by Jack Moore

So the detailed available option arguments are:

  • url - (default value is false) - The url of the large photo to be displayed. If no url is provided, zoom uses the src of the first child IMG element inside the element it is assigned to.
  • on (default value is 'mouseover'): The type of event that triggers zooming. Choose from mouseover, grab, click, or toggle.
  • duration (default value is 120): The fadeIn/fadeOut speed of the large image.
  • target (default value is false): A selector or DOM element that should be used as the parent container for the zoomed image.
  • touch (default value is true): Enables interaction via touch events.
  • magnify (default value is 1): This value is multiplied against the full size of the zoomed image. The default value is 1, meaning the zoomed image should be at 100% of its natural width and height.
  • callback (default value is false): A function to be called when the image has loaded. Inside the function, this references the image element.
  • onZoomIn (default value is false): A function to be called when the image has zoomed in. Inside the function, this references the image element.
  • onZoomOut (default value is false)*: A function to be called when the image has zoomed out. Inside the function, this references the image element.

Related: Adjusting product image's Zoom magnification factor in woocommerce 3

Upvotes: 2

Related Questions