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

[4.x]: TypeError Cannot assign string to property craft\commerce\elements\Subscription::$dateCanceled of type ?DateTime #2831

Closed
JansonChe opened this issue May 31, 2022 · 2 comments
Labels
bug commerce4 Issues related to Commerce v4

Comments

@JansonChe
Copy link

What happened?

Description

While testing out the subscription cancel functionality (in both CP and example template) this error showed up. The subscription in Stripe is successfully canceled, but not in Craft Commerce. Therefore the subscriptions are now out of sync. I've tested both immediate cancellation and by end of period. While immediate cancellation only cancels the Stripe Subscription, the one for end of period seems to work after a reload, but both show this error.

Is there a way to get Stripe and Craft Subscriptions in sync again?

Thanks a lot!

Steps to reproduce

  1. Setup Craft 4 with Commerce Light
  2. Add Stripe Plugin
  3. Setup 2 Products in Stripe, each with 2 Prices (monthly/yearly)
  4. Make 4 Plans in Craft Commerce and assign the 4 pricing variants.
  5. Copy example Twig Templates accordion to docs.
  6. Login as a User (any)
  7. Subscribe to one of the plans
  8. Try to cancel the subscription in CP or FE (the error appears in both cases)
  9. Reload after error and compare Stripe to Commerce Subscriptions panel.

Expected behavior

  • Error should not get Stripe and Commerce out of sync. Either prevent both cancellations or try to sync when trying to cancel the already canceled subscription again.

Actual behavior

  • Subscription gets canceled in Stripe, but not Craft

Craft CMS version

4.0.3

Craft Commerce version

4.0.1

PHP version

8.1.6

Operating system and version

Linux 5.10.76-linuxkit (Craft Nitro)

Database type and version

MySQL 8.0.24

Image driver and version

No response

Installed plugins and versions

  • "craftcms/commerce": "4.0.1"
  • "craftcms/commerce-stripe": "3.0.0"
  • "verbb/formie": "2.0.0-beta.10"
@JansonChe JansonChe added commerce4 Issues related to Commerce v4 bug labels May 31, 2022
@mtnorthrop
Copy link

I've also run into this same error on Commerce 4.0.1, Craft CMS 4.0.3.

@nfourtythree
Copy link
Contributor

Hi

Thank you for reporting this, we have pushed a fix which will be included in the next release of Commerce.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug commerce4 Issues related to Commerce v4
Projects
None yet
Development

No branches or pull requests

3 participants