diff --git a/changelog/add-use-site-logo-when-no-woopay-logo-defined b/changelog/add-use-site-logo-when-no-woopay-logo-defined new file mode 100644 index 00000000000..0afbfccf655 --- /dev/null +++ b/changelog/add-use-site-logo-when-no-woopay-logo-defined @@ -0,0 +1,4 @@ +Significance: patch +Type: add + +Fall back to site logo when a custom WooPay logo has not been defined diff --git a/includes/woopay/class-woopay-session.php b/includes/woopay/class-woopay-session.php index c36489f4047..2caf2be5d9e 100644 --- a/includes/woopay/class-woopay-session.php +++ b/includes/woopay/class-woopay-session.php @@ -340,7 +340,14 @@ private static function get_init_session_request() { $account_id = WC_Payments::get_account_service()->get_stripe_account_id(); - $store_logo = WC_Payments::get_gateway()->get_option( 'platform_checkout_store_logo' ); + $site_logo_id = get_theme_mod( 'custom_logo' ); + $site_logo_url = $site_logo_id ? ( wp_get_attachment_image_src( $site_logo_id, 'full' )[0] ?? '' ) : ''; + $woopay_store_logo = WC_Payments::get_gateway()->get_option( 'platform_checkout_store_logo' ); + + $store_logo = $site_logo_url; + if ( ! empty( $woopay_store_logo ) ) { + $store_logo = get_rest_url( null, 'wc/v3/payments/file/' . $woopay_store_logo ); + } include_once WCPAY_ABSPATH . 'includes/compat/blocks/class-blocks-data-extractor.php'; $blocks_data_extractor = new Blocks_Data_Extractor(); @@ -361,7 +368,7 @@ private static function get_init_session_request() { 'email' => '', 'store_data' => [ 'store_name' => get_bloginfo( 'name' ), - 'store_logo' => ! empty( $store_logo ) ? get_rest_url( null, 'wc/v3/payments/file/' . $store_logo ) : '', + 'store_logo' => $store_logo, 'custom_message' => self::get_formatted_custom_message(), 'blog_id' => Jetpack_Options::get_option( 'id' ), 'blog_url' => get_site_url(),