'icon' => $this->get_card_type_icon_url( 'mastercard' ), ), 'amex' => array( 'name' => 'American Express', 'icon' => $this->get_card_type_icon_url( 'amex' ), ), 'discover' => array( 'name' => 'Discover', 'icon' => $this->get_card_type_icon_url( 'discover' ), ), 'jcb' => array( 'name' => 'JCB', 'icon' => $this->get_card_type_icon_url( 'jcb' ), ), ); return $card_types; } /** * Get the card type icon URL. * * @param string $card_type Card type. * @return string Card type icon URL. */ private function get_card_type_icon_url( $card_type ) { $assets_path = 'assets/images/payment-methods-cards/'; $icon_path = WC_ABSPATH . $assets_path . $card_type . '.svg'; $icon_url = \plugins_url( $assets_path . $card_type . '.svg', WC_PLUGIN_FILE ); return file_exists( $icon_path ) ? $icon_url : ''; } /** * Get other payment method icons from available gateways. * * @return array Other payment method icons. */ private function get_other_payment_method_icons() { $available_gateways = WC()->payment_gateways->get_available_payment_gateways(); $other_payment_methods = array(); if ( empty( $available_gateways ) ) { return $other_payment_methods; } foreach ( $available_gateways as $gateway ) { if ( 'yes' === $gateway->enabled ) { if ( 'woocommerce_payments' === $gateway->id ) { continue; } $icon_url = ''; if ( is_callable( array( $gateway, 'get_icon_url' ) ) ) { $icon_url = $gateway->get_icon_url(); } if ( ! empty( $icon_url ) ) { $other_payment_methods[] = array( 'name' => $gateway->get_title(), 'icon' => $icon_url, ); } } } usort( $other_payment_methods, function ( $a, $b ) { return strcmp( $a['name'], $b['name'] ); } ); return $other_payment_methods; } /** * Get the available payment methods. * * @return array Available payment methods. */ private function get_available_payment_methods() { $enabled_cards = array_values( $this->get_enabled_card_types() ); $payment_methods = array_merge( $enabled_cards, $this->get_other_payment_method_icons() ); return $payment_methods; } }
Fatal error: Uncaught Error: Class "Automattic\WooCommerce\Blocks\BlockTypes\PaymentMethodIcons" not found in /htdocs/wp-content/plugins/woocommerce/src/Blocks/BlockTypesController.php:118 Stack trace: #0 /htdocs/wp-includes/class-wp-hook.php(341): Automattic\WooCommerce\Blocks\BlockTypesController->register_blocks('') #1 /htdocs/wp-includes/class-wp-hook.php(365): WP_Hook->apply_filters(NULL, Array) #2 /htdocs/wp-includes/plugin.php(522): WP_Hook->do_action(Array) #3 /htdocs/wp-settings.php(742): do_action('init') #4 /htdocs/wp-config.php(98): require_once('/htdocs/wp-sett...') #5 /htdocs/wp-load.php(50): require_once('/htdocs/wp-conf...') #6 /htdocs/wp-blog-header.php(13): require_once('/htdocs/wp-load...') #7 /htdocs/index.php(17): require('/htdocs/wp-blog...') #8 {main} thrown in /htdocs/wp-content/plugins/woocommerce/src/Blocks/BlockTypesController.php on line 118