To track the life-cycle of a subscription, the WooCommerce Subscriptions extension creates relationships between orders and subscriptions. This guide provides an overview of each of these relationships and the corresponding order type.
If you haven’t already, you should read the Subscriptions Guide for Store Managers before continuing. The information here will also be easier to understand if you have read the Guides on the subscription renewal process, subscription switching and WooCommerce orders.
Előfizetések vs. Megrendelések
Before understanding the ways an order can be related to a subscription, it’s important to understand the purpose and data on a subscription and compare that with an order, to see how the two are similar and how they differ.
Subscriptions are an extension of orders. A subscription has all the same data as an order, including a:
- payment method
- billing & shipping address
- product, fee, tax and shipping line items.
However, a subscription also has data an order does not have, including:
- recurring billing period and interval
- next payment, trial end and start date
- related orders.
The reason subscription data includes all order data is because of the similarities in the purpose of the two items. Specifically, an order is a record of a transaction in the past. A subscription is an agreement for transactions in the future.
The reason orders are linked to a subscription is because a subscription can have transactions in the past. These transactions may have:
- created the subscription
- been part of the subscription’s renewal billing terms; or
- changed the subscription, for example by upgrading a product on it.
Because of this, a subscription can have multiple orders associated with it to record different historical transactions during its life-cycle. An order can also be associated with one transaction that relates to multiple subscriptions.
Subscription Order Types
A subscription can have a range of orders linked to it, including:
- Renewal orders
- Resubscribe orders
- Switch orders
- Parent order
Each of these order types are the same as an order created to track a purchase via the normal WooCommerce checkout process. The key difference is that the order is linked to a subscription via a special relationship to track part of that subscriptions life-cycle.
These relationships are also not unique. For example, a Resubscribe Order can also be a Parent Order because a new subscription is created when resubscribing to an expired or cancelled subscription.
The parent order for a subscription records the creation of the subscription. Normally, this is a record of a subscription product being purchased via the WooCommerce checkout process.
When a customer adds a subscription product to the cart, and then completes the checkout process to pay for that product, an order is created to record that payment. A subscription is also created to manage the future payments agreed to when purchasing that product. That order becomes the subscription’s Parent Order.
Parent Orders are usually only created via checkout. However, they can also be created via the Add/Edit Subscription administration screen, or import tools when migrating subscriptions to WooCommerce.
Importantly, a subscription can only ever have one Parent Order. A subscription can only ever be created once, so it only needs one Parent Order to record that transaction. On the other hand, one Parent Order can be related to multiple subscriptions, because it’s possible to purchase different subscription products in the same transaction.
As subscriptions are not necessarily created via a transaction, a subscription will not always have a Parent Order. For example, subscriptions created via the Add Subscription administration screen will not have a Parent Order unless such an order is also manually created.
A key part of a subscription are its recurring payments. Each recurring payment is recorded in a Renewal Order during the subscription renewal process.
Renewal Orders are normally created automatically on the subscription’s predefined billing schedule. They can be used to record either an automatic or manual recurring payment. Or no payment at all, in the case of subscriptions with a $0 total.
Renewal Orders can also be manually created via the Edit Subscription administration screen.
Importantly, a subscription can have multiple Renewal Orders associated with it, as multiple recurring payments may have been processed during its life-cycle. For example, a monthly subscription that has been active for 12 months will have 11 Renewal Orders.
A Renewal Order can also be associated with multiple subscriptions. This makes it possible to batch process recurring payments for different subscriptions. This feature isn’t built into WooCommerce Subscriptions, but it is possible with underlying design.
If a customer wants to extend an expired subscription, or resume a previously cancelled subscription, she can resubscribe to the subscription on the My Account > View Subscription page.
The resubscribe process takes the customer through the normal cart and checkout flow to complete sign-up on the subscription. As part of this flow, an order is created to record the transaction. This order is both a Resubscribe Order, as it records the resubscribe action, and a Parent Order, as a new subscription is created to continue the old subscription’s terms.
A Resubscribe Order is linked to both the old subscription which is being resubscribed to, and the new subscription being created to continue the old subscriptions terms. This means a subscription can have up to two Resubscribe Orders associated with it – one to record its creation, if it was created by resubscribing to another subscription, and one to record a new subscription created from its terms after it expired or was cancelled.
When a customer upgrades or downgrades their subscription, the switch process takes the customer through the normal cart and checkout flow to complete the transaction.
As part of this flow, an order is created to record the upgrade or downgrade transaction. As this order records the switch transaction, it is linked to the subscription using a relationship referred to as a Switch Order.
In some cases, the Switch Order will also be a Parent Order, as when the new subscription’s schedule does not align to existing products on the existing subscription, a new subscription will be created.
Importantly, a subscription can have multiple Switch Orders associated with it, as a customer can upgrade or downgrade the same subscription multiple times in different transactions.