WooCommerce get_weight钩子

时间:2017-07-13 14:03:42

标签: php wordpress woocommerce hook-woocommerce

WooCommerce get_weight()是否有任何钩子如下所示。好像在那里 - 但它不起作用

// define the <get_hook_prefix>weight callback 

function filter_get_hook_prefix_weight( $this_weight, $instance ) { 
$this_weight = 10;
return $this_weight; 
}
// add the filter 
add_filter( "woocommerce_data_get_weight", 'filter_get_hook_prefix_weight', 10, 2 );

1 个答案:

答案 0 :(得分:1)

// define the <get_hook_prefix>weight callback 
function filter_get_hook_prefix_weight( $this_weight, $instance ) { 
$this_weight = 10;
return $this_weight; 
}
// add the filter 
add_filter( "woocommerce_product_get_weight", 'filter_get_hook_prefix_weight', 10, 2 );

试试这个