Php 钩重钩

Php 钩重钩,php,wordpress,woocommerce,hook-woocommerce,Php,Wordpress,Woocommerce,Hook Woocommerce,有没有像下面这样的钩子。看起来好像在那里,但它不起作用 // 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_we

有没有像下面这样的钩子。看起来好像在那里,但它不起作用

// 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 );
//定义权重回调
函数筛选器\u get\u hook\u前缀\u weight($this\u weight,$instance){
$此重量=10;
返回$this_重量;
}
//添加过滤器
添加过滤器(“woocommerce\u data\u get\u weight”,“filter\u get\u hook\u prefix\u weight”,10,2);
//定义权重回调
函数筛选器\u get\u hook\u前缀\u weight($this\u weight,$instance){
$此重量=10;
返回$this_重量;
}
//添加过滤器
添加过滤器(“woocommerce\u product\u get\u weight”,“filter\u get\u hook\u prefix\u weight”,10,2);
试试这个

//定义权重回调
函数筛选器\u get\u hook\u前缀\u weight($this\u weight,$instance){
$此重量=10;
返回$this_重量;
}
//添加过滤器
添加过滤器(“woocommerce\u product\u get\u weight”,“filter\u get\u hook\u prefix\u weight”,10,2);
试试这个

// 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 );