Automattic / woocommerce-subscriptions-core

Subscriptions core package for WooCommerce
Other
81 stars 29 forks source link

Always attach our Checkout Blocks integration to fix issues when Subscriptions is loaded before WooCommerce #487

Closed mattallan closed 11 months ago

mattallan commented 11 months ago

Fixes #486

Description

There's an issue where the Checkout Block is not properly showing the subscription recurring totals on the checkout and are instead being rendered as simple/single prices.

image

After some investigation, I found out this was being caused by our Checkout Blocks support code never being attached because at the time of initing WC Subscriptions, the Automattic\WooCommerce\Blocks\Package class doesn't exist yet.

To fix this, I've made sure we're always attaching our woocommerce_blocks_loaded code and then moved our version checks to happen inside those callbacks.

How to test this PR

  1. Activate WooCommerce 7.9, Subscriptions 5.3.1 & the latest Stripe
  2. Add a Checkout Block page
  3. Add a subscription product to your cart
  4. On trunk you'll see a non-recurring total on the checkout image
  5. On this branch you should see the correct recurring totals: image

Product impact