所以我找到了这个
$points_to_award = (int) apply_filters( 'gamipress_wc_points_per_purchase_total_points_to_award', $points_to_award, $user_id, $points_type, $order_id, $percent );
在插件代码里面,我怎么能用这个来覆盖$points_to_award的值呢?2在我的function.php里面使用add_filter?
我试过:
function my_custom_function($points_to_award) {
$points_to_award = ($order->get_total() - $order->get_shipping_total()) * ($ratio/100);
return $points_to_award;
}
add_filter( 'gamipress_wc_points_per_purchase_total_points_to_award', 'my_custom_function' );
但没有用
1条答案
按热度按时间ljsrvy3e1#
您需要获取订单ID和比率,如下所示