Skip to content

Commit

Permalink
Update the checkout blocks hook that's attached to the process checko…
Browse files Browse the repository at this point in the history
…ut flow to use the latest hook (#523)

* Remove unnecessary blocks version checks as we support WC 7.7 which includes blocks 10.0.2

* Add changelog entry
  • Loading branch information
mattallan authored Oct 13, 2023
1 parent bb93611 commit 8c8ccce
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 10 deletions.
1 change: 1 addition & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

= 6.4.0 - xxxx-xx-xx =
* Add - Use admin theme color and the correct WooCommerce colors.
* Dev - Update the Checkout Blocks hooks used from `woocommerce_blocks_checkout_` to `woocommerce_store_api_checkout`.

= 6.3.0 - 2023-10-06 =
* Add - Introduce the "Subscription Relationship" column under the Orders list admin page when HPOS is enabled.
Expand Down
6 changes: 1 addition & 5 deletions includes/class-wc-subscriptions-checkout.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,7 @@ public static function init() {
add_action( 'woocommerce_checkout_order_processed', array( __CLASS__, 'process_checkout' ), 100, 2 );

// Same as above, but this is for the Checkout block.
if ( class_exists( 'Automattic\WooCommerce\Blocks\Package' ) && ( version_compare( \Automattic\WooCommerce\Blocks\Package::get_version(), '6.3.0', '>=' ) || \Automattic\WooCommerce\Blocks\Package::is_experimental_build() ) ) {
add_action( 'woocommerce_blocks_checkout_order_processed', array( __CLASS__, 'process_checkout' ), 100, 1 );
} else {
add_action( '__experimental_woocommerce_blocks_checkout_order_processed', array( __CLASS__, 'process_checkout' ), 100, 1 );
}
add_action( 'woocommerce_store_api_checkout_order_processed', array( __CLASS__, 'process_checkout' ), 100, 1 );

// Some callbacks need to hooked after WC has loaded.
add_action( 'woocommerce_loaded', array( __CLASS__, 'attach_dependant_hooks' ) );
Expand Down
6 changes: 1 addition & 5 deletions includes/class-wcs-cart-renewal.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,7 @@ public function attach_dependant_hooks() {
add_action( 'woocommerce_checkout_update_order_meta', array( &$this, 'set_order_item_id' ), 10, 2 );

// After order meta is saved, get the order line item ID for the renewal so we can update it later
if ( version_compare( \Automattic\WooCommerce\Blocks\Package::get_version(), '7.2.0', '>=' ) ) {
add_action( 'woocommerce_store_api_checkout_update_order_meta', array( &$this, 'set_order_item_id' ) );
} else {
add_action( 'woocommerce_blocks_checkout_update_order_meta', array( &$this, 'set_order_item_id' ) );
}
add_action( 'woocommerce_store_api_checkout_update_order_meta', array( &$this, 'set_order_item_id' ) );

// Don't display cart item key meta stored above on the Edit Order screen
add_action( 'woocommerce_hidden_order_itemmeta', array( &$this, 'hidden_order_itemmeta' ), 10 );
Expand Down

0 comments on commit 8c8ccce

Please sign in to comment.