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 );
答案 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 );
试试这个