简体   繁体   中英

WooCommerce woocommerce_review_order_after_cart_contents hook with custom text

I am trying to add a custom text on the checkout form

I have used the following hook but the message actually ended up on top of the product and not after the cart contents And it appeared twice

add_action('woocommerce_review_order_after_cart_contents', 'payable_now');
function payable_now() {
    echo 'Payable Now';
}

Payable Now - no ajax

Then I tried the following hook which did not return the message twice but it still added the Payable Now on top of the Product

add_action('woocommerce_review_order_after_cart_contents', 'payable_now');
function payable_now() {
    if ( ! is_ajax() ) {
        echo 'Payable Now';
    }
}

Payable now with ajax

Where I actually nee the text to appear is right after the start date displaying here

Where payable now should display

use a table element as tr td th

add_action('woocommerce_review_order_after_cart_contents', 'payable_now');
    function payable_now() {
         echo '<th> Payable Now </th>';
    }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM