Skip to content

Commit

Permalink
Check if account service is defined before checking if Stripe account…
Browse files Browse the repository at this point in the history
… is valid (#7116)
  • Loading branch information
shendy-a8c authored Sep 5, 2023
1 parent 73b1653 commit 09fe431
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions changelog/fix-7109-fatal-on-wc-home-task
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fix

Potential fatal error when viewing WooCommerce home because we try to check if store has been fully onboarded but account service is not yet initialized.
3 changes: 2 additions & 1 deletion includes/class-wc-payments-tasks.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ public static function init() {
* Adds a task to the WC 'Things to do next' task list the if disputes awaiting response.
*/
public static function add_task_disputes_need_response() {
if ( ! WC_Payments::get_account_service()->is_stripe_account_valid() ) {
$account_service = WC_Payments::get_account_service();
if ( ! $account_service || ! $account_service->is_stripe_account_valid() ) {
return;
}

Expand Down

0 comments on commit 09fe431

Please sign in to comment.