For example, in this guide we’ll use an AutomateWoo workflow to expire subscriptions created from a monthly subscription product on December 31st regardless of whether the subscription product is purchased on January 1st or December 30th.
- AutomateWoo version 4.4 or newer
- WooCommerce Subscriptions 2.4 or newer
- (optional) the free WooCommerce Custom Price String plugin
The first step to creating a fixed expiration subscription is to create a product that will be used to offer your customers the subscription.
We’ll use a monthly subscription product below but you could use another period like daily or weekly depending on your needs.
- Go to WooCommerce > Add Product.
- Click Simple Subscription as the product type.
- Set the price to meet your needs and then the billing schedule to be monthly.
After setting up the product, it will display the total cost for each renewal. This price string will not include the expiration date, which is set systematically by the AutomateWoo workflow.
While the price displayed is correct, you may choose to convey to your customers that the subscription will end on a fixed date. To display this information alongside the price, use the free WooCommerce Custom Price String plugin.
To set a custom display price with this plugin:
- Upload, install & activate the Custom Price String plugin
- Go to WooCommerce > Edit Product screen for the product
- Enter the Custom Price String
- Click Update
While this is completely discretionary, it’s recommended to include the following:
- Fixed expiration date
For example, with our monthly product that’s set to expire on December 31st, we can use the following price string:
$25 every month, ending December 31st
Now that we have our product, we need to create a workflow in AutomateWoo to set the correct status on the fixed workflow run date (also our expiration date).
Since our subscription will only require one status change, only one workflow is needed.
To change the status of the subscription to Expired, we’ll need to use the following:
- Go to AutomateWoo > Workflows
- Click Add Workflow
- Enter a Title for the workflow, like Fixed Expiration Date (Small Woorld Magazine – Monthly Subscription)
- Click Trigger
- Choose the Subscription Created trigger
- Click the Subscription products input
- Enter the name of the subscription product created earlier
- Click Add Action
- Click Subscription – Change Status
- In the Subscription Status dropdown, choose Expired
- In the Timing box (located on the right hand side of your workflow page), choose Fixed
- In the Date input, choose the date you’d like the subscription to expire. In our example, we’ll choose 2019-12-31 (this will queue the workflow to run on December 31st)
With the above workflow, the subscription lifecycle will be:
- Day 0: Customer purchases the subscription product. An initial order records payment for the cost set in the subscription product settings.
- Renewal: If the subscription product was purchased at least one renewal in advance of the fixed expiration date, renewal will process as set in the subscription product settings. If the amount of time before the fixed expiration date does not exceed the set renewal period, no renewal orders will be recorded before the workflow is processed.
- Queued Workflow: Since the trigger used for the workflow is immediate, but the timing value set is delayed, the workflow will be sent to the AutomateWoo queue. This queues the workflow to run on the date set in the Timing box.
- Fixed Expiration: Upon reaching the fixed expiration date, which was set in the Timing box, the workflow will process from the queue, effectively changing the status of the subscription to Expired.
This example is just one use-case of this specific workflow. There are many other options when setting up a workflow like the one above, all of which can be designed for the use of the individual store they’re being used on.
Since the subscription product that was set up above did not include an expiration in the product settings, the initial email sent to the customer will display as ending When Cancelled.
During the initial checkout, the recurring totals will display the next expected renewal date in both the cart and checkout pages. Since the AutomateWoo workflow from above will not trigger until after the subscription is created, special consideration should be taken to ensure this is conveyed to the customer.
In the case that the subscription product is purchased in the same renewal period that the fixed expiration workflow will run, no renewals will be processed. The recurring totals will still display the next expected payment date, which will never be reached before the workflow is triggered, changing the status of the subscription to Expired.
One possible workaround can be added by placing this snippet in your functions.php file. This will add a new line in the cart totals that will display when the customer should expect the subscription to expire.
As can be seen above, this workflow will trigger on a fixed date, which is also defined by the set year. Since there is not currently a way to trigger on a set month and day without defining the year, the workflow Timing box will need to be updated to reflect the new fixed date each year thereafter.
There is a current idea to allow for setting a month/day without a set year. If you feel this would be useful to your store’s flow, please vote!