add_action( 'woocommerce_thankyou', 'orderReceived' );
function orderReceived($order_id)
{
$order = wc_get_order($order_id);
if (!$order->has_status('failed') && did_action('woocommerce_thankyou') === 1) {
addPoints(1000, 'add', 'order');
}
}
我如何才能确保上面的函数在WooCommerce感谢页面上只触发一次?
每次我重新加载感谢页面时,它都会触发.这意味着一个人可以得到无限的积分.