Subscribe All The Things v2

Today marks two years since WooCommerce Subscribe All The Things was born – and frankly, we couldn’t have asked for a better time than this to announce the release of Subscribe All The Things 2.0 into the wild.

For those of you that haven’t heard about it, Subscribe All The Things – or SATT, in short – is an experimental mini-extension for WooCommerce Subscriptions that aspires to add support for recurring purchases to any WooCommerce product type. Since its inception, WooCommerce Subscriptions has required a special subscription-specific product type to be created in order to make an item available on a recurring basis. This coupling:

  • made it difficult to offer one-off and recurring purchase options available with the same product; and
  • made it hard to offer subscriptions for grouped/custom product types.

After an alignment of the stars that brought Prospress and SomewhereWarm together, chatting about a shared desire to explore this untapped potential, Subscribe All The Things was officially kickstarted. SATT 1.0 was built as a proof-of-concept and released a couple months later, around the time that Subscriptions 2.0 arrived. SATT 1.0:

  1. Made it possible to attach subscription options (internally called subscription schemes) to non-subscription product types, such as Simple/Variable products, Product Bundles, Composite Products and Mix and Match Products.
  2. Introduced the concept of Cart Subscriptions.

However, SATT 1.0 came with its own fair share of shortcomings:

  • It did not really extend product objects with a subscription state component and did not include a public API for getting/setting the subscription state of product objects.
  • It did not provide a formal definition of the subscription scheme concept.
  • It did not consistently make product prices and other method return values dependent on their active subscription state.

The growth and popularity of Subscribe All The Things helped us learn quite a lot about how to improve the way products are treated in WooCommerce Subscriptions. Soon after its release, we came to realize that we had bigger plans for it than we initially thought. Before setting out to explore new ideas, we decided to take a step back and write SATT from scratch.

Meet Subscribe All The Things 2.0. The new version:

  • Introduces a Product API that can be used to get/set the subscription data and state on product objects.
  • Provides a formal (object) definition of the subscription scheme concept.
  • Redefines the way prices and other method return values are transformed depending on the subscription state of a product.
  • Streamlines the UI of the Product Data > Subscriptions tab panel.
  • Adds WooCommerce 3.0 / WooCommerce Subscriptions 2.2 support.
  • Brings many improvements to the existing integration with Product Bundles and Composite Products.
  • Introduces unit tests.

Upgrading to 2.0

If you are a Shop Owner, you may notice that version 2.0 includes mostly under-the-hood changes and fixes. In case you are wondering, 2.0.0 is fully compatible with 1.1.2 – you should be able to upgrade without issues. However, if you have any custom code (such as snippets or plugins) running on top of Subscribe All The Things, you must make sure that they are tested and updated to work with 2.0 before updating.

If you are a Developer, you’ll find there’s quite a lot to grok in 2.0. The best way to look at it is to treat it as new code:

  • Start with the Product API (includes/class-wcs-att-product.php, includes/product/class-wcs-att-product-schemes.php and includes/product/class-wcs-att-product-prices.php) and read the inline documentation and comments.
  • To understand how product prices are coupled with the active subscription state of product objects, check out includes/product/class-wcs-att-product-prices.php and includes/product/class-wcs-att-product-price-filters.php.
  • Have a look at the Scheme object in includes/class-wcs-att-scheme.php.
  • Move to includes/product/class-wcs-att-cart.php to see how the Product API is being used in cart context.
  • Finish with includes/class-wcs-att-order.php and note how the subscription state of a product object can be restored from an associated order item.

Short on time? The unit tests in tests/unit/ can give you a quick, hands-on idea of how the new Subscription Product API works!

What’s Next

We have just tagged 2.0.0-beta.1 and invite (challenge) you to take it for a spin and share your impressions! If you have written a plugin on top of Subscribe All The Things, this is a good time to become familiar with the new code and send feedback.

Found a bug? Please open a new issue and one of the developers or users from its tiny community will do their best to help you out!

Interested in contributing? We’d love to hear from you!

2 responses to Subscribe All The Things v2

Leave a reply

Basic HTML is allowed. Your email address will not be published.