What’s New in Subscriptions 2.6

WooCommerce Subscriptions is a premium WooCommerce extension

Subscriptions 2.6 includes two features, 2 enhancements, and other fixes and updates. Version 2.6 is a “minor” release and should be backwards compatible with sites running WooCommerce Subscriptions 2.0 and above.

In order to ensure a smooth update process, please refer to the Subscriptions Upgrade Guide.

New Features

Improved early renewal user experience ↑ Back to top

Customers who choose to renew their subscriptions early have in the past been required to go through the checkout flow. This meant the customer had to complete the checkout form, select a payment method, and process the payment.

For customers who have an automatic payment method already set on their subscription, this process can theoretically be skipped entirely. 

With Subscriptions 2.6, there is a new option in WooCommerce > Settings > Subscriptions which will allow customers to bypass the checkout and streamline this process. If enabled, customers who click the Renew now button will be displayed a modal. A modal is a window which appears over the top of the main page content. The early renewal modal includes information about the subscription line items, the amount they will be charged, the payment method which will be used, and what will be the new next payment date.

By using the modal, customers can renew early without leaving their view subscription page, with 2 clicks, and with no page loads.

Customer’s early renewal modal

Requirements

For customers to be displayed the early renewal modal the following requirements must be met: 

  • The early renewal modal needs to be enabled via the admin settings. Upon upgrading to 2.6 this will be disabled by default. See steps below to enable this feature.
  • The subscription must have an automatic payment method.
  • The subscription must be eligible for early renewals.
Customers can choose to pay via the checkout if they wish to add a coupon or use a different address.

To enable the early renewal via modal setting: 

  1. Go to WooCommerce > Settings > Subscriptions
  2. Scroll down to the Renewals section. 
  3. Under Early Renewal enable: 
    1. Accept Early Renewal Payments, and 
    2. Accept Early Renewal Payments via a Modal
Admin Early renewal via Modal setting – Enabled
To learn more about the early renewal process, you can read our Subscriptions Early Renewal Guide.

View which subscriptions and orders contribute to report figures ↑ Back to top

When viewing subscription reports with 2.6, you will be able to see which subscriptions and orders are contributing to a particular figure. 

Subscription Events by Date report links

By clicking one of the report data points with a you will be redirected to the admin order or subscription table with the list of subscriptions or orders which contribute to the reported figure listed. 

For example, to find the subscriptions which were cancelled in the last 7 days:

  1. Go to WooCommerce > Reports > Subscriptions tab.
  2. Select Last 7 Days from the date selection options.
  3. On the left-hand side of the report, click the ‘subscription cancellations’ link.
  4. You will be redirected to the list of subscriptions which have been cancelled in the last 7 days. 
Admin subscriptions table listing subscriptions cancelled in the last 7 days

The reports which support contribution views are: 

  1. New Subscriptions – the number of subscriptions created during the selected report period. This includes subscriptions created manually, imported or created by a customer placing an order. This includes subscriptions with orders pending payment.
  2. Subscription Signups – the number of subscriptions purchased in parent orders created during the selected report period. This represents the new subscriptions created by customers placing an order via checkout.
  3. Subscription Resubscribes – The number of resubscribe orders processed during the report period.
  4. Subscription Renewals – the number of renewal orders processed during the selected report period.
  5. Subscription Switches – the number of subscriptions upgraded, downgraded, or cross-graded during the selected report period.
  6. Subscription Cancellations – the number of subscriptions cancelled by the customer or store manager during the selected report period. 
  7. Ended Subscriptions – the number of subscriptions in the selected report period which have either expired or reached the end of the prepaid term if it was previously cancelled.
  8. Current Subscriptions – the number of subscriptions during the selected report period with an end date in the future and a status other than pending.

Enhancements

Improved switching calculations ↑ Back to top

WooCommerce Subscriptions 2.6 includes a complete rewrite of the code which calculates the amount a customer pays in upgrade fees and the number of days the subscription is extended by when downgrading between two products.

The code prior to this rewrite was complicated and led to bugs in the calculations being difficult to fix. 

As part of this rewrite, 12 known issues and possibly more unknown bugs have been fixed. 

To assist in understanding and troubleshooting a switch upgrade cost and outcome, information about every subscription switch will now be logged to the wcs-switch-cart-items log. Each log entry will include important switch values used in the proration calculations.

Admin switched item log

To view the switched cart item log:

  1. Go to WooCommerce > Status > Logs (tab)
  2. From the drop-down on the right-hand side select the wcs-switch-cart-items log file
  3. Click View

Improved handling of unloadable orders in the related orders table ↑ Back to top

Sometimes errors can happen and orders cannot be loaded from the database. Prior to 2.6, this scenario would lead to errors on the admin edit subscription screen as we tried to generate the related orders table. 

Because a subscription keeps an internal record of its related orders, in 2.6, if the order fails to load from the database correctly, the order will be listed in the related orders table and include a link to documentation that will help store managers find and resolve the underlying cause.

Unloadable orders on the admin edit subscription related orders table

Other Changes

Switching subscription setting changes  ↑ Back to top

To enable third-party developers to include their own product types in the list of switchable products, the setting which allows store managers to turn on switching between certain product types has been converted into multiple checkboxes rather than a drop-down.

Allow switching between admin settings

All existing store settings will be kept unchanged and how the settings work in the plugin’s code will continue to work as they have in the past.

Updates to customer-facing templates ↑ Back to top

WooCommerce core uses sentence case (capitalizing only the first word and any proper nouns) in headings in customer-facing templates. Subscriptions 2.6 includes a review of all the my account, cart, and checkout templates and updates all headings to follow WooCommerce in order to be consistent across the board. 

Customer’s view subscription page

For Developers and Store Builders

Rest API: removed subscription line items included in the response ↑ Back to top

Line items which have been removed from the subscription by the customer from their My Account > View Subscription page, will be included in the Subscription endpoint GET response. 

On top of the line item data, you will now receive the same data for the line items which have been removed. For example:

"line_items": [
 {
     "id": 2911,
     "name": "Small Woorld Subscription",
     "sku": "",
     "product_id": 24,
     "variation_id": 0,
     "quantity": 1,
     "tax_class": "",
     "price": "30.00",
     "subtotal": "30.00",
     "subtotal_tax": "0.00",
     "total": "30.00",
     "total_tax": "0.00",
     "taxes": [],
     "meta": []
 }]
"removed_line_items": [
 {
     "id": 2917,
     "name": "Small Woorld Membership",
     "sku": "",
     "product_id": 23,
     "variation_id": 0,
     "quantity": 1,
     "tax_class": "",
     "price": "100.00",
     "subtotal": "100.00",
     "subtotal_tax": "0",
     "total": "100.00",
     "total_tax": "0",
     "taxes": [],
     "meta": []
 }]
The removed line item data exists on existing sites running Subscriptions prior to 2.6. This isn’t new data. Subscriptions with line items which were removed before upgrading to 2.6, keep track of this data. Subscriptions 2.6 just exposes this data via the REST API.

Switching refactor ↑ Back to top

As part of the switching refactor, there are 3 new classes which are used to calculate the prorated price and subscription date updates while switching. 

WCS_Switch_Totals_Calculator – The WCS_Switch_Totals_Calculator object takes a WC_Cart object as the only parameter in its constructor. It’s main function is calculate_prorated_totals() which will calculate all the prorated totals for all the switch items in the cart. It has other functions which are used to determine what switch settings are in place on the store and functions to set values in the cart item’s data.

WCS_Switch_Cart_Item – For every item in the cart which records a switch between one subscription line item and another, a WCS_Switch_Cart_Item object will be created. This class is responsible for calculating various things about the switch. Specifically how many days into the current term is the current subscription, what’s the price per day of the new and old products, whether the switch is occuring during a trial, etc.

WCS_Add_Cart_Item – The add cart item class extends WCS_Switch_Cart_Item. It is similar to a switch cart item, however, it doesn’t have an item on the current subscription which it is planned to replace. It only contains a couple of functions which override functions which aren’t necessary when an existing subscription line item isn’t being switched. Under normal use, this object isn’t used within Subscriptions core, it exists to enable third-parties to add items to existing subscriptions, and inherit all the built-in proration calculations that switching brings. 

Repair subscription line items with missing _has_trial meta

During Subscriptions 2.6 development we discovered that subscription products with a trial period purchased on sites running WC 3.0, haven’t been storing the _has_trial meta. The impact of this missing data is fairly small as it is only used by Subscriptions to calculate a subscription line item’s sign up fee and that’s used to apportion sign up fees while switching.

Subscriptions 2.6 includes an upgrade routine which will find and update all subscription line items with this missing data.

Apply BEM classes to Subscriptions templates  ↑ Back to top

In Subscriptions 2.6 all the My Account templates have been updated to use the BEM (Block, Element, Modifier) methodology. WooCommerce has in recent versions started to move towards using the BEM methodology. BEM provides a standard whereby theme developers and third-party developers can, on a more granular level, target HTML blocks, elements, and elements within specific blocks.  

You can read more about the BEM methodology and its key concepts here.

Template Changes

templates/admin/status.php templates/cart/cart-recurring-shipping.php templates/checkout/form-change-payment-method.php templates/checkout/recurring-totals.php templates/myaccount/my-subscriptions.php templates/myaccount/related-orders.php templates/myaccount/related-subscriptions.php templates/myaccount/subscription-details.php templates/myaccount/subscription-totals.php templates/myaccount/view-subscription.php templates/single-product/add-to-cart/subscription.php templates/single-product/add-to-cart/variable-subscription.php

Emails

All subscription email templates have been updated to include the additional content added in WooCommerce 3.7.0. 

templates/emails/admin-new-renewal-order.php templates/emails/admin-new-switch-order.php templates/emails/admin-payment-retry.php templates/emails/cancelled-subscription.php templates/emails/customer-completed-renewal-order.php templates/emails/customer-completed-switch-order.php templates/emails/customer-payment-retry.php templates/emails/customer-processing-renewal-order.php templates/emails/customer-renewal-invoice.php templates/emails/email-order-details.php templates/emails/expired-subscription.php templates/emails/on-hold-subscription.php templates/emails/subscription-info.php templates/emails/plain/admin-new-renewal-order.php templates/emails/plain/admin-new-switch-order.php templates/emails/plain/admin-payment-retry.php templates/emails/plain/cancelled-subscription.php templates/emails/plain/customer-completed-renewal-order.php templates/emails/plain/customer-completed-switch-order.php templates/emails/plain/customer-payment-retry.php templates/emails/plain/customer-processing-renewal-order.php templates/emails/plain/customer-renewal-invoice.php templates/emails/plain/expired-subscription.php templates/emails/plain/on-hold-subscription.php templates/emails/plain/subscription-info.php

New templates

templates/html-early-renewal-modal-content.php templates/html-modal.php templates/myaccount/subscription-totals-table.php

Deprecated Functions, Classes, Properties, Actions and Filters

Functions

  • WC_Subscriptions_Cart::check_valid_add_to_cart() – this function has moved to WC_Subscriptions_Cart_Validator::check_valid_add_to_cart()
  • WC_Subscription::get_completed_payment_count()– there is now a new function, WC_Subscription::get_payment_count(), which can be used for the same purpose and new concepts too like $subscription->get_payment_count( 'refunded' ) or $subscription->get_payment_count( 'net' )
  • WC_Subscriptions_Manager::process_subscription_payments_on_order() – this function was not not being used by Subscriptions core and included pre-Subscriptions 2.0 concepts.
  • WC_Subscriptions_Manager::process_subscription_payment_failure_on_order() – this function was not not being used by Subscriptions core and included pre-Subscriptions 2.0 concepts.

Filters

  • woocommerce_subscription_payment_completed_count – this filter was not compatible with the new function WC_Subscription::get_payment_count(), as it filtered the combined parent and renewal completed order counts. You should use woocommerce_subscription_parent_payment_completed_count and woocommerce_subscription_renewal_payment_completed_count filters to provide the individual counts.

Properties

  • WCS_Action_Scheduler::$action_hooks – this property is protected and should no longer be used by any third-party extending the WCS_Action_Scheduler class. WCS_Action_Scheduler itself will now use WCS_Action_Scheduler::get_date_types_to_schedule() to schedule and unschedule events on subscription status update.

WooCommerce - the most customizable eCommerce platform for building your online business.

Back to the top