- Issue created by @rubenjara
- Assigned to TomTech
- Status changed to Closed: duplicate
over 1 year ago 6:29pm 8 July 2023 - πΊπΈUnited States TomTech
Hi @rubenjara!
Thanks for the report.
After researching, this appears to be an issue in commerce recurring, which has been resolved in the current dev release:
https://www.drupal.org/project/commerce_recurring/issues/3337411 π RecurringOrderManager calls onSubscriptionRenew before updating subscription Fixed
Previously,
recurringOrderManager
was callingonSubscriptionRenew()
before callingsetRenewedTime()
$subscription->getType()->onSubscriptionRenew($subscription, $order, $next_order); $next_order->save(); // Update the subscription with the new order and renewal timestamp. $subscription->addOrder($next_order); $subscription->setRenewedTime($this->time->getCurrentTime()); $subscription->setNextRenewalTime($next_billing_period->getEndDate()->getTimestamp()); $subscription->save();
This is fixed in the patch, by setting the renewed time before calling onSubscriptionRenew:
$subscription->setRenewedTime($this->time->getCurrentTime()); $subscription->setNextRenewalTime($next_billing_period->getEndDate()->getTimestamp()); $subscription->getType()->onSubscriptionRenew($subscription, $order, $next_order); $next_order->save(); // Update the subscription with the new order and renewal timestamp. $subscription->addOrder($next_order); $subscription->save();