php - Adjusting product image's Zoom magnification factor in woocommerce 3
Get the solution ↓↓↓Solution:
This is possible using{-code-1}
dedicated filter hook.
The hook undocumented available parameters in the options array are:
$zoom_options = array (
'url' => false,
'callback' => false,
'target' => false,
'duration' => 120, // Transition in milli seconds (default is 120)
'on' => 'mouseover', // other options: grab, click, toggle (default is mouseover)
'touch' => true, // enables a touch fallback
'onZoomIn' => false,
'onZoomOut' => false,
'magnify' => 1, // Zoom magnification: (default is 1 | float number between 0 and 1)
);
Related: Available parameters details for WooCommerce product image zoom options
Usage with {-code-1} filter hook to change the magnification level (for example we mill minimize the zoom level a bit less):
add_filter( '{-code-1}', 'custom_single_product_zoom_options' );
function custom_single_product_zoom_options( $zoom_options ) {
// Changing the magnification level:
$zoom_options['magnify'] = 0.7;
return $zoom_options;
}
Code goes in functions.php file of your active child theme (or active theme). Tested and work.
Before with default magnification (set to1
):
Before with magnification set to0.7
:
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: sqlstate[hy000] [1698] access denied for user 'root'@'localhost'
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.