Move WooCommerce Notices

User
Move woocommerce-NoticeGroup woocommerce-NoticeGroup-checkout error top of form
Assistant
To move the WooCommerce error notices (like `woocommerce-NoticeGroup` or `woocommerce-NoticeGroup-checkout`) to the top of your checkout form, you can use a WooCommerce hook to reposition them.

Here’s how you can do it:

### Step 1: Remove the default notices from their original position
In your theme’s `functions.php` or a custom plugin, add the following code:

remove_action( 'woocommerce_before_checkout_form', 'woocommerce_checkout_notices', 10 );

### Step 2: Re-add them to the top of the checkout form
Then, re-add the notices at the very top of the form using:

add_action( 'woocommerce_before_checkout_form', 'woocommerce_checkout_notices', 1 );

### Full code snippet:

add_action( 'init', function() {
    // Remove default checkout notices position
    remove_action( 'woocommerce_before_checkout_form', 'woocommerce_checkout_notices', 10 );

    // Add checkout notices to top of form
    add_action( 'woocommerce_before_checkout_form', 'woocommerce_checkout_notices', 1 );
});

### Optional: Add custom styling (if needed)
If you also want to ensure styling is correct, you can add custom CSS:

.woocommerce-NoticeGroup-checkout {
    margin-bottom: 20px;
}

Let me know if you'd like this only on specific pages or under specific conditions (like AJAX errors only)!

User
Sorry for delay , Actually we are working on our demo server for code related issues and you are right that Currently our server ips blocked at sage pay ,
we may need to our ips to sagepay
Also I assume this will not a issue on live server
Correct above sentence
Assistant
No worries! Here's a corrected and more polished version of your message:

**Sorry for the delay. We are currently working on our demo server to resolve some code-related issues. You are right — our server IPs are currently blocked by Sage Pay. We may need to whitelist our IPs with Sage Pay.**

**Also, I assume this issue will not occur on the live server.**

Let me know if you'd like to make it more formal or casual depending on your audience.

Leave a Comment

Your email address will not be published. Required fields are marked *