woocommerce_review_order_after_cart_contents hook printing/firing content twice

Created on 20 Mar 2015  路  1Comment  路  Source: woocommerce/woocommerce

I am using woocommerce_review_order_after_cart_contents hook to display some custom text on the checkout page but the following code entered into functions.php prints the message twice on the checkout page:

/** 
* Add Custom Shipping Message to the checkout 
**/
add_action('woocommerce_review_order_after_cart_contents', 'shipping_message');
function shipping_message() {
echo 'Heavy parcels to the Highlands, Scottish Islands and Channel Islands may require an additional shipping surcharge.';
}

I have tested the above with twenty twelve theme and all plugins deactivated except WooCommerce.

WooCommerce 2.1.0

WooCommerce 2.2.0

WooCommerce 2.2.11

WooCommerce 2.3.7

https://woothemes.zendesk.com/agent/tickets/272307
@seanreloaded @mikejolley @ChromeOrange

Most helpful comment

Use:

add_action('woocommerce_review_order_after_cart_contents', 'shipping_message');
function shipping_message() {
    if ( ! is_ajax() ) {
        echo 'Heavy parcels to the Highlands, Scottish Islands and Channel Islands may require an additional shipping surcharge.';
    }
}

Ref #7226

>All comments

Use:

add_action('woocommerce_review_order_after_cart_contents', 'shipping_message');
function shipping_message() {
    if ( ! is_ajax() ) {
        echo 'Heavy parcels to the Highlands, Scottish Islands and Channel Islands may require an additional shipping surcharge.';
    }
}

Ref #7226

Was this page helpful?
0 / 5 - 0 ratings