Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new subscription webhook not creating scheduled action #742

Open
BFlorek95 opened this issue Dec 8, 2024 · 3 comments
Open

new subscription webhook not creating scheduled action #742

BFlorek95 opened this issue Dec 8, 2024 · 3 comments
Labels
type: bug-needs-confirmation This issue is for a bug that needs to be verified.

Comments

@BFlorek95
Copy link

BFlorek95 commented Dec 8, 2024

Describe the bug

When a new subscription is created the subscription.created webhook is not working.,
In the past there would be a webhook called for all new subscription creations it would create a scheduled action for this webhook.

Since one of the newer updates this is no longer happening consistently.

webhooks I have are in picture below
Image

Ive noticed the subscription.updated will receive the information but for some reason the subscription.created never works consistently.

picture below shows the subscription scheduled actions where it sent information to webhook for subscription.updated
Image

subscription creation date pictured below
Image

Im unsure if this has to do with the strip issue where the payment intents are being created but never receiving the completed payment notification from stripe. This has been happening for over a year but its rare / becoming more common where stripe payment doesn't finish on WooCommerce even though payment was captured thru stripe.

From the looks this is first time a brand new subscription got stuck with just the payment intent from stripe.
Usually its the renewals that all get stuck.
Image

That being said the subscription was still created and should have created the scheduled action for the subscription.created webhook

@BFlorek95 BFlorek95 added the type: bug The issue is a confirmed bug. label Dec 8, 2024
@mattallan
Copy link
Contributor

Hi @BFlorek95, I'm not having any luck with reproducing this issues.

Are your subscriptions created through the standard checkout flow, or are these created via some other method?

I've tested:

  • New subscription via checkout with HPOS enabled/disabled
  • New subscription via shortcode checkout and block checkout
  • Creating subscriptions via WP Admin dashboard

That being said the subscription was still created and should have created the scheduled action for the subscription.created webhook

Yeah this is my thought as well.

The current subscriptions.created webhooks are triggered off the following hooks:

  • 'wcs_api_subscription_created'
  • 'woocommerce_process_shop_subscription_meta'
  • 'woocommerce_checkout_subscription_created'

I'm curious if there's some hook that's not firing on your store or possibly something else is going on. Are there any failed

Would you be open to try adding extra hooks that the subscription.created webhook is triggered on? Here's a quick snippet to add woocommerce_new_subscription to the list of hooks.

add_filter( 'woocommerce_subscriptions_webhook_topics', function( $topic_hooks ) {
	$topic_hooks['subscription.created'][] = 'woocommerce_new_subscription';
	return $topic_hooks;
}, 10 , 1 );

@mattallan mattallan added type: bug-needs-confirmation This issue is for a bug that needs to be verified. and removed type: bug The issue is a confirmed bug. labels Dec 20, 2024
@BFlorek95
Copy link
Author

BFlorek95 commented Dec 21, 2024

Hi @mattallan

sub scriptions are created thru the standard checkout method.
I do use stripe if that makes a difference?
I also have some that will use apple/android pay which can mess things up mostly just double creates a sub when the payment fails but will clean itself up later on.

I did recently have this issue unsure what caused this to be sent
b'[]'
{50 vars in 804 bytes} [Fri Dec 20 23:59:52 2024] POST => generated 17 bytes in 279 msecs (HTTP/1.1 200) 3 headers in 110 bytes (1 switches on core 0)

It was a sub-new webhook but nothing was sent. it originated from my server too.

I do ocassionally get failed scheduled actions. Seems to happen more and more but it always has to do with stripe. Essentially the subscription creates the renewal order. The stripe payment intent is created then the action fails due to a timeout.

As you can see in the screenshot below I have 2 failed items #3516 is the one that failed due to a timeout.
Image

I do have one issue thats been a fatal error in the logs for a while. Its completely random when the error occurs
Image

Unsure how to fix this as the php memory size was increased and still getting the error.

@BFlorek95
Copy link
Author

BFlorek95 commented Dec 21, 2024

Hi @mattallan

I just took a look back at the fatal logs and see where the issue is

This is the fatal-errors from day/time the webhook didnt fire
Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug-needs-confirmation This issue is for a bug that needs to be verified.
Projects
None yet
Development

No branches or pull requests

2 participants