Subscribe All The Things v2

Edited on April 14, 2019 — Subscribe All The Things is now available on WooCommerce.com under a new name: All Products For WooCommerce Subscriptions (APFS). Read the full story here.

TL;DR

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.

Background

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!

5 responses to Subscribe All The Things v2

  1. eli0086

    This is awesome – just trying some things out with it. I was wondering if you are planning to add options like in the WC subscriptions for “every 2 weeks” and “every 3rd week” for the frequency options? We currently use those options a lot for a protein bar website due to organic ingredients and shelf life. Is there a way to add that to the plugin manually? That would be a great feature!

    • Manos Psychogyiopoulos Post Author

      Hey there,

      The ability to choose a period interval has been part of SATT since v1.0 — if you can’t see this option, it could be due to a plugin conflict: https://cl.ly/44213x0j0D37

      To troubleshoot this:

      1. Temporarily switch back to a default WordPress theme (or Storefront). If this resolves the issue, then please bring this to the attention of your theme author.
      2. If the issue persists, then disable all other plugins except for WooCommerce, WooCommerce Subscriptions and Subscribe All the Things. If this fixes the issue, then slowly re-enable plugins until you find the one that triggers it.

      If your site is already live, the best way to do this would be to set up a staging site, for example using a plugin such as WP Staging or Duplicator — and then follow these troubleshooting steps on the staging site.

    • eli0086

      Thank you – found the options! This is a great addition to subscriptions!

Comments are closed.