getErrorCode(), $error->getMessage(), array( 'status' => $error->getCode() ) ); } $allow_ai_connection = get_option( 'woocommerce_blocks_allow_ai_connection' ); if ( ! $allow_ai_connection ) { try { throw new RouteException( 'ai_connection_not_allowed', __( 'AI content generation is not allowed on this store. Update your store settings if you wish to enable this feature.', 'woocommerce' ), 403 ); } catch ( RouteException $error ) { return new \WP_Error( $error->getErrorCode(), $error->getMessage(), array( 'status' => $error->getCode() ) ); } } return true; } }