/** * Returns the number of failed payments for a given subscription. * * @param $order WC_Order The WC_Order object of the order for which you want to determine the number of failed payments. * @param product_id int The ID of the subscription product. * @return string The key representing the given subscription. * @since 1.0 */ public static function get_failed_payment_count($order, $product_id) { $failed_payment_count = WC_Subscriptions_Manager::get_subscriptions_failed_payment_count($order->customer_user, WC_Subscriptions_Manager::get_subscription_key($order->id, $product_id)); return $failed_payment_count; }