• Resolved Ainsley Clark

    (@ainsleyclark)


    I’m trying to add an input field for an alert as CSS only way of dismissing an alert. It seems as if Woocommerce is removing any inputs from /notices/error.php\ and is not rendering in the DOM.

    php
    <!-- =====================
        Alert - Error
        ===================== -->
    <?php foreach ( $notices as $notice ) : ?>
        <div class="alert alert-error">
    
            <!-- Why is woo removing this? -->
            <input type="checkbox" class="alert-toggle" id="<?php echo $id; ?>" />
    
            <!-- Container -->
            <div class="alert-container">
                <!-- Icon -->
                <i class="icon alert-icon"></i>
                <!-- Text -->
                <div class="alert-text">
                    <?php echo wc_get_notice_data_attr( $notice ); ?>
                    <?php echo wc_kses_notice( $notice['notice'] ); ?>
                </div>
                <label for="<?php echo $id; ?>" class="alert-close" aria-label="Close"></label>
            </div><!-- /Container -->
        </div><!-- /Alert -->
    <?php endforeach; ?>
    

    Any ideas?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Mirko P.

    (@rainfallnixfig)

    Hi there,

    This is a fairly complex development topic. I’m going to leave it open for a bit to see if anyone is able to chime in to help you out.

    You can also visit the WooCommerce Facebook Community group or the #developers channel of the WooCommerce Community Slack.

    Thread Starter Ainsley Clark

    (@ainsleyclark)

    I’m presuming that Woocommerce is stripping due to security reasons. Is there anything I can do to sanitize the result?

    Mirko P.

    (@rainfallnixfig)

    Hi @ainsleyclark,

    You would probably receive feedback in the channels I mentioned where developers hang out. On this forum, there aren’t many developers and we are more focused on the default functions of core WooCommerce.

    Thanks.

    Mirko P.

    (@rainfallnixfig)

    Hello there,

    I’ll mark this topic as solved for now. Hopefully, the above resources for developers were helpful.

    Please feel free to open a new topic if you have any other questions.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Woo is removing input field from notices/error.php?’ is closed to new replies.