-
-
Save Nishadup/11ed95d620f497db7a9ca7ef6ae1ded5 to your computer and use it in GitHub Desktop.
Alter WooCommerce Product Weight and Dimension Dynamically
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function filter_get_hook_prefix_weight($this_weight, $instance) { | |
if (!$this_weight || $this_weight < 0.6) $this_weight = .6; | |
return $this_weight; | |
} | |
function filter_get_hook_prefix_height($this_height, $instance) { | |
if (!$this_height || $this_height < 20 ) $this_height = 20; | |
return $this_height; | |
} | |
function filter_get_hook_prefix_width($this_width, $instance) { | |
if (!$this_width || $this_width < 20 ) $this_width = 20; | |
return $this_width; | |
} | |
function filter_get_hook_prefix_length($this_length, $instance) { | |
if (!$this_length || $this_length < 20 ) $this_length = 20; | |
return $this_length; | |
} | |
add_filter("woocommerce_product_get_height", 'filter_get_hook_prefix_height', 19, 2); | |
add_filter("woocommerce_product_get_width", 'filter_get_hook_prefix_width', 19, 2); | |
add_filter("woocommerce_product_get_length", 'filter_get_hook_prefix_length', 19, 2); | |
add_filter("woocommerce_product_get_weight", 'filter_get_hook_prefix_weight', 19, 2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment