1. Documentation /
  2. AutomateWoo /
  3. Workflow guides /
  4. Subscription workflows /
  5. Create a fixed expiration subscription

Create a fixed expiration subscription

This guide demonstrates how to use AutomateWoo together with WooCommerce Subscriptions to create subscriptions with a fixed expiration date regardless of the subscription start date.

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.

Prerequisites

↑ Back to top

Fixed expiration subscription product

↑ Back to top

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.

Step 1: Create the monthly subscription product

↑ Back to top
  1. Go to WooCommerce > Add Product.
  2. Click Simple Subscription as the product type.
  3. Set the price to meet your needs and then the billing schedule to be monthly.
Example Monthly Subscription Product

Step 2: Display a custom price string (optional)

↑ Back to top

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:

  1. Upload, install & activate the Custom Price String plugin
  2. Go to WooCommerce > Edit Product screen for the product
  3. Enter the Custom Price String
  4. Click Update

While this is completely discretionary, it’s recommended to include the following:

  • Price
  • 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

Example Custom Price String on a fixed expiring Monthly Subscription Product

Subscription expiration workflow

↑ Back to top

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:

  1. Go to AutomateWoo > Workflows
  2. Click Add Workflow
  3. Enter a Title for the workflow, like Fixed Expiration Date (Small Woorld Magazine – Monthly Subscription)
  4. Click Trigger
  5. Choose the Subscription Created trigger
  6. Click the Subscription products input
  7. Enter the name of the subscription product created earlier
  8. Click Add Action
  9. Click Subscription – Change Status
  10. In the Subscription Status dropdown, choose Expired
  11. In the Timing box (located on the right hand side of your workflow page), choose Fixed
  12. 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)
Example Workflow to Expire a Subscription on a Fixed Date

Summary of the subscription lifecycle

↑ Back to top

With the above workflow, the subscription lifecycle will be:

  1. Day 0: Customer purchases the subscription product. An initial order records payment for the cost set in the subscription product settings.
  2. 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.
  3. 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.
  4. 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.

Other Considerations

↑ Back to top

Emails

↑ Back to top

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.

Recurring Totals

↑ Back to top

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.

Subsequent Workflows

↑ Back to top

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!