• I have been working on this plugin to create subscriptions on my website but the cron job was not generating renewal orders. So i tried to debug and found a quick fix/update for the plugin:

    In Plugin file ?yith-woocommerce-subscription/includes/class.yith-wc-subscription-cron.php Under function renew_orders() or at line 123 its checking for 0===$order_pending

    $sbs           = ywsbs_get_subscription( $subscription->ID );
    $order_pending = $sbs->get( 'renew_order' );
    if ( 0 === $order_pending ) {
    						$order_id = YWSBS_Subscription_Order()->renew_order( $subscription->ID );
    						update_post_meta( $subscription->ID, 'renew_order', $order_id );
    						delete_post_meta( $subscription->ID, '_renew_order' );
    					}

    However in the $sbs if the order needs to be renewed it returns an empty string so it fails to validate that IF statement.

    So to Fix This change the IF statement to the following :

    if ( 0 === $order_pending || $order_pending==="" ) {
    //rest code same
    }

    And after this on every Rerun of the Cron Job it will successfully generates new renewal of the subscription.

Viewing 1 replies (of 1 total)
  • Plugin Support Alberto Martin

    (@albertomrtn)

    Hi @whitedevilpy, this is probably happening because of the gateway you are using. Please note that the FREE version can only make recurring payments with PayPal Standard.

Viewing 1 replies (of 1 total)
  • The topic ‘Fix: Subscription Renewals not working’ is closed to new replies.