notice_enabled() ) { $this->show_notice(); } } private function notice_enabled() { return WC_Connect_Options::get_option( 'error_notice', false ); } private function show_notice() { $link_status = admin_url( 'admin.php?page=wc-status&tab=connect' ); $link_dismiss = add_query_arg( array( 'wc-connect-error-notice' => 'disable' ) ); $error = $this->notice_enabled(); if ( is_wp_error( $error ) && 'product_missing_weight' === $error->get_error_code() ) { $error_data = $error->get_error_data(); $product_id = $error_data['product_id']; $product = wc_get_product( $product_id ); if ( ! $product || $product->has_weight() ) { $this->disable_notice(); return; } $product_name = WC_Connect_Compatibility::instance()->get_product_name( $product ); $message = sprintf( __( '%2$s does not have a weight defined.
Shipping rates cannot be calculated. Add a weight for %2$s so your customers can purchase this item.', 'woocommerce-services' ), get_edit_post_link( $product_id ), $product_name ); } else { $message = sprintf( __( 'An error occurred in WooCommerce Services. Details are logged here.', 'woocommerce-services' ), $link_status ); } $allowed_html = array( 'a' => array( 'href' => array() ), 'strong' => array(), 'br' => array(), ); ?>