Php WooCommerce积分和奖励-移动render_product_消息

Php WooCommerce积分和奖励-移动render_product_消息,php,plugins,woocommerce,Php,Plugins,Woocommerce,我正在使用WooCommerce积分和奖励插件 默认情况下,单个产品消息(赚取最多x点)会在产品摘录后立即显示。然而,我想改变它 我已经尝试了很多东西,但是没有成功。。。但我认为我已经接近正确答案了 我希望有人能给我帮助 function test() { global $wc_points_rewards; remove_action( 'woocommerce_single_product_summary', array($wc_points_rewards->produc

我正在使用WooCommerce积分和奖励插件

默认情况下,单个产品消息(赚取最多x点)会在产品摘录后立即显示。然而,我想改变它


我已经尝试了很多东西,但是没有成功。。。但我认为我已经接近正确答案了

我希望有人能给我帮助

function test() {
   global $wc_points_rewards;
   remove_action( 'woocommerce_single_product_summary', array($wc_points_rewards->product, 'render_product_message' ) );
}
add_action( 'woocommerce_single_product_summary', 'test', 5 );
添加“render_product_message”的类是在WC_Points_Rewards上初始化的WC_Points_Rewards_product

WC_积分_奖励_产品(我只发布相关方法)

WC_积分_奖励(我只发布相关方法)。 在此类的_构造方法上调用includes方法

private function includes()
{
    // product class
    require('includes/class-wc-points-rewards-product.php');
    $this->product = new WC_Points_Rewards_Product();
}

最好重命名class-wc-points-rewards-product.php文件中的字段,以显示元素的“after”或“before”。当然,每次有更新时都必须重命名,但编写挂钩可能会把事情搞砸

这对我很有用:

 add_action( 'init', 'remove_points');
 function remove_points()
 {
     global $wc_points_rewards;
     remove_action( 'woocommerce_before_add_to_cart_button',  [ $wc_points_rewards->product, 'render_product_message' ], 15 );
    }

“我已经尝试了很多东西,但是没有成功……”——什么样的东西,为什么没有成功?在我的评论中,有一个例子是我尝试添加到functions.php中的东西。我还尝试使用$wc_points_奖励,而不是$wc_points_rewars->product。但是我认为正如我所发布的那样是正确的,因为类是$wc\u point\u rewars->product而不是$wc\u point\u rewars。你能给我们展示一下添加
呈现产品消息的
添加操作()
函数吗?另外,这个
add_action
来自哪个类?我们如何访问这个类的实例?请编辑问题以添加所需信息。我已更改帖子并添加更多代码和信息。
 add_action( 'init', 'remove_points');
 function remove_points()
 {
     global $wc_points_rewards;
     remove_action( 'woocommerce_before_add_to_cart_button',  [ $wc_points_rewards->product, 'render_product_message' ], 15 );
    }