We recently introduced yearly subscriptions with monthly payments at WP Desk and I needed to customize our email automations.
We heavily use AutomateWoo at WP Desk to send emails. I wanted to send different emails to customers with monthly and yearly payments. There is no subscription rule to filter by billing period, but I thought I could use subscription rule based on the custom field.
For emails which should be sent to customers with yearly payments, I configured the rule like this:
I was pretty sure that it would work, but I checked the next day if the workflow got fired and found out that no emails were sent. Bummer!
I did some digging and it proved that the custom field rule was using the get_meta
function to get custom subscription meta data. However the _billing_period is not available with this function, because the standard billing period field is in fact a subscription property. The get_meta
function would only work with the truly custom meta data.
I contacted AutomateWoo support and once again it proved that such a basic (you’d think) feature is not available. There is a workaround to set up some rules based on product variations, but this would require a lot of clicking, as we have quite a few products and variations.
So again I created a custom rule for AutomateWoo to be able to target only subscriptions based on the billing period. You’ll find the complete code below:
By using this custom rule I was able to easily choose the billing period that I wanted:
And it works perfectly!
Make sure to check my other subscription custom rule based on parent order status and the official AutomateWoo docs for custom rules.