pronamic / woocommerce-subscriptions

WooCommerce Subscriptions, Git-ified. Synced manual! This repository is just a mirror of the WooCommerce Subscriptions plugin. Please do not send pull requests and issues.
https://woocommerce.com/products/woocommerce-subscriptions/
413 stars 181 forks source link

Store period in subscription (renewal) order items #10

Closed remcotolsma closed 4 months ago

remcotolsma commented 6 months ago

For each subscription order item, we want to know for what period the order item is. Currently, WooCommerce Subscription does not store this information with the order items. It can possibly be derived from the order date and the interval/period settings for the subscription and/or subscription product. But a customer or administrator may also be able to manually extend a few periods in advance. This may result in a number of renewal orders on the same date, but strictly speaking the renewal orders are for consecutive periods. Ideally, you want to make it clear on payment descriptions and invoices for what period the payments are. Also in accounting you want to spread the amounts over the correct period. This was previously a challenge in the Pronamic Pay plugin and now we are also encountering this problem within the Pronamic Moneybird plugin.

In the Pronamic Pay integration we initially used code (<= v4.5.6) that determined and set the period:

https://github.com/pronamic/wp-pronamic-pay-woocommerce/blob/f21bf0b8b83e0c5682a9b3825356d8b423714e59/src/Gateway.php#L795-L825

We removed this for renewal orders in v4.5.7:

https://github.com/pronamic/wp-pronamic-pay-woocommerce/blob/f2e6b22cd44c7f4c8a4886f1ab10a5f8c038f6e9/src/Gateway.php#L739-L767

See commit:

https://github.com/pronamic/wp-pronamic-pay-woocommerce/commit/05be2c3cf23cd3b2488606e9aa8007c993ac1136#diff-da93ebacf7f0dab5d7c471c91f0e17ae0392749606fd28497fe3391b2b42f875L812-L825

This has been removed after consultation at @Pronamic HQ with @rvdsteege, because the period cannot be determined reliably at this time.


Scherm­afbeelding 2024-04-11 om 11 27 00
remcotolsma commented 4 months ago

I have develop the following plugin for this: 🎉 https://github.com/pronamic/pronamic-woocommerce-subscriptions-period

It's active on our shop.