• Our WooCommerce store includes memberships, which are created and sold as a type of subscription. The subscription term is one month and it auto-renews every month until canceled. We use Keap (InfusionSoft) tags to track certain aspects of each subscription, and naturally the tags should renew every month when the subscription does. However, there are some bugs in the Keap part of this process, which I need to find and fix.

    Problem: I can’t find the code that is handling the Keap updates. I can’t even find the code that processes the renewals themselves in WooCommerce Subscriptions. I’ve searched do_action() calls, I’ve searched add_action and add_filter calls, and I can’t find anything that looks relevant. I see a lot of do_action calls that name hooks, but no associated add_action or add_filter calls. I see several hooks that might be associated with renewals, but the names never appear in any do_action() call. The most confusing part is some add_filter() calls that have arrays of arrays as the second parameter, such as:

    switch ( $webhook->get_resource() ) {

    ? ? ? ? ? ? case 'order':

    ? ? ? ? ? ? ? ? $topic_hooks['order.created'][] = 'wcs_webhook_order_created';

    ? ? ? ? ? ? ? ? break;

    ? ? ? ? ? ? case 'subscription':

    ? ? ? ? ? ? ? ? $topic_hooks = apply_filters( 'woocommerce_subscriptions_webhook_topics', array(

    ? ? ? ? ? ? ? ? ? ? 'subscription.created' ?=> array(

    ? ? ? ? ? ? ? ? ? ? ? ? 'wcs_api_subscription_created',

    ? ? ? ? ? ? ? ? ? ? ? ? 'wcs_webhook_subscription_created',

    ? ? ? ? ? ? ? ? ? ? ? ? 'woocommerce_process_shop_subscription_meta',

    ? ? ? ? ? ? ? ? ? ? ),

    ? ? ? ? ? ? ? ? ? ? 'subscription.updated' ?=> array(

    ? ? ? ? ? ? ? ? ? ? ? ? 'wcs_webhook_subscription_updated',

    ? ? ? ? ? ? ? ? ? ? ? ? 'woocommerce_update_subscription',

    ? ? ? ? ? ? ? ? ? ? ),

    ? ? ? ? ? ? ? ? ? ? 'subscription.deleted' ?=> array(

    ? ? ? ? ? ? ? ? ? ? ? ? 'woocommerce_subscription_trashed',

    ? ? ? ? ? ? ? ? ? ? ? ? 'woocommerce_subscription_deleted',

    ? ? ? ? ? ? ? ? ? ? ? ? 'woocommerce_api_delete_subscription',

    ? ? ? ? ? ? ? ? ? ? ),

    ? ? ? ? ? ? ? ? ? ? 'subscription.switched' => array(

    ? ? ? ? ? ? ? ? ? ? ? ? 'wcs_webhook_subscription_switched',

    ? ? ? ? ? ? ? ? ? ? ),

    ? ? ? ? ? ? ? ? ), $webhook );

    ? ? ? ? ? ? ? ? break;

    ? ? ? ? }

    What does this code do? How do I trace this maze of actions that are named but apparently never called, and filters that are written but don’t seem to ever be run? Is there some trick to tracing filter and action calls, other than “search for the filter/action name in the site code and see what comes up?” How can I find the code I’m looking for?

Viewing 1 replies (of 1 total)
  • Plugin Support shahzeen(woo-hc)

    (@shahzeenfarooq)

    Hi there!

    WooCommerce Subscriptions handles renewals through various hooks, such as:

    • woocommerce_scheduled_subscription_payment (when a renewal payment is due)
    • woocommerce_subscription_renewal_payment_complete (when a renewal is successful)

    For more details you can use this article. https://woocommerce.com/document/subscriptions/develop/action-reference/

    If your concern is specifically about Keap (InfusionSoft) tags not updating, that would depend on how your integration is set up. In this forum, we only provide support for WooCommerce core features, and third-party integrations are out of scope.

    To confirm if WooCommerce Subscriptions is processing renewals correctly, you can:

    • Check if renewal orders are being created in WooCommerce.
    • Use a tool like Query Monitor to trace hooks in action.

    If renewals are working correctly in WooCommerce but Keap is not updating as expected, I’d recommend reaching out to Keap support or your developer for further assistance in debugging the integration. I can recommend?WooExperts?and?Codeable.io?as options for getting professional help. Alternatively, you can also ask your development questions in the??WooCommerce Community Slack?as custom code falls outside our usual?scope of support.

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.