$this->merchant_center->is_setup_complete(), 'get_started_url' => $this->get_start_url(), ]; } /** * Register a service. */ public function register(): void { add_action( 'woocommerce_new_product', [ $this, 'handle_submission' ], 10, 2 ); add_action( 'woocommerce_update_product', [ $this, 'handle_submission' ], 10, 2 ); } /** * @param int $product_id * @param WC_Product $product */ public function handle_submission( int $product_id, WC_Product $product ) { /** * Array of `true` values for each product IDs already handled by this method. Used to prevent double submission. * * @var bool[] $already_updated */ static $already_updated = []; $field_id = $this->get_visibility_field_id(); // phpcs:disable WordPress.Security.NonceVerification // nonce is verified by self::verify_nonce if ( ! $this->verify_nonce() || ! isset( $_POST[ $field_id ] ) || isset( $already_updated[ $product_id ] ) ) { return; } // only update the value for supported product types if ( ! in_array( $product->get_type(), ProductSyncer::get_supported_product_types(), true ) ) { return; } try { $visibility = empty( $_POST[ $field_id ] ) ? ChannelVisibility::cast( ChannelVisibility::SYNC_AND_SHOW ) : ChannelVisibility::cast( sanitize_key( $_POST[ $field_id ] ) ); // phpcs:enable WordPress.Security.NonceVerification $this->meta_handler->update_visibility( $product, $visibility ); $already_updated[ $product_id ] = true; } catch ( InvalidValue $exception ) { // silently log the exception and do not set the product's visibility if an invalid visibility value is sent. do_action( 'woocommerce_gla_exception', $exception, __METHOD__ ); } } /** * @return string * * @since 1.1.0 */ protected function get_visibility_field_id(): string { return $this->prefix_field_id( 'visibility' ); } }
Warning: class_implements(): Class Automattic\WooCommerce\GoogleListingsAndAds\Admin\MetaBox\ChannelVisibilityMetaBox does not exist and could not be loaded in /htdocs/wp-content/plugins/google-listings-and-ads/src/Internal/DependencyManagement/AbstractServiceProvider.php on line 119

Fatal error: Uncaught TypeError: array_key_exists(): Argument #2 ($array) must be of type array, bool given in /htdocs/wp-content/plugins/google-listings-and-ads/src/Internal/DependencyManagement/AbstractServiceProvider.php:120 Stack trace: #0 /htdocs/wp-content/plugins/google-listings-and-ads/src/Internal/DependencyManagement/AbstractServiceProvider.php(120): array_key_exists('Automattic\\WooC...', false) #1 /htdocs/wp-content/plugins/google-listings-and-ads/src/Internal/DependencyManagement/CoreServiceProvider.php(380): Automattic\WooCommerce\GoogleListingsAndAds\Internal\DependencyManagement\AbstractServiceProvider->conditionally_share_with_tags('Automattic\\WooC...', 'Automattic\\WooC...', 'Automattic\\WooC...', 'Automattic\\WooC...', 'Automattic\\WooC...') #2 /htdocs/wp-content/plugins/google-listings-and-ads/vendor/league/container/src/ServiceProvider/ServiceProviderAggregate.php(102): Automattic\WooCommerce\GoogleListingsAndAds\Internal\DependencyManagement\CoreServiceProvider->register() #3 /htdocs/wp-content/plugins/google-listings-and-ads/vendor/league/container/src/Container.php(172): Automattic\WooCommerce\GoogleListingsAndAds\Vendor\League\Container\ServiceProvider\ServiceProviderAggregate->register('Automattic\\WooC...') #4 /htdocs/wp-content/plugins/google-listings-and-ads/src/Container.php(90): Automattic\WooCommerce\GoogleListingsAndAds\Vendor\League\Container\Container->get('Automattic\\WooC...') #5 /htdocs/wp-content/plugins/google-listings-and-ads/src/Infrastructure/GoogleListingsAndAdsPlugin.php(139): Automattic\WooCommerce\GoogleListingsAndAds\Container->get('Automattic\\WooC...') #6 /htdocs/wp-content/plugins/google-listings-and-ads/src/Infrastructure/GoogleListingsAndAdsPlugin.php(97): Automattic\WooCommerce\GoogleListingsAndAds\Infrastructure\GoogleListingsAndAdsPlugin->maybe_register_services() #7 /htdocs/wp-includes/class-wp-hook.php(310): Automattic\WooCommerce\GoogleListingsAndAds\Infrastructure\GoogleListingsAndAdsPlugin->Automattic\WooCommerce\GoogleListingsAndAds\Infrastructure\{closure}('') #8 /htdocs/wp-includes/class-wp-hook.php(334): WP_Hook->apply_filters(NULL, Array) #9 /htdocs/wp-includes/plugin.php(517): WP_Hook->do_action(Array) #10 /htdocs/wp-settings.php(495): do_action('plugins_loaded') #11 /htdocs/wp-config.php(96): require_once('/htdocs/wp-sett...') #12 /htdocs/wp-load.php(50): require_once('/htdocs/wp-conf...') #13 /htdocs/wp-blog-header.php(13): require_once('/htdocs/wp-load...') #14 /htdocs/index.php(17): require('/htdocs/wp-blog...') #15 {main} thrown in /htdocs/wp-content/plugins/google-listings-and-ads/src/Internal/DependencyManagement/AbstractServiceProvider.php on line 120