woocommerce_order_details_after_order_table is for completed orders, not the checkout. Try woocommerce_review_order_after_order_total
Thanks for the tip, Mike. I changed my code and added a div so I could style it. It shows up after “Your Order” but it displays before the listing of items, not after the table with the total.
And I’m getting two instances of the message. I have no idea why it would do a double-display. One instance shows up and then another appears after the table with the totals appears.
Here’s my code…
add_action('woocommerce_review_order_after_order_total', 'subscription_notice');
function subscription_notice() {
?><div class="subscription_notice"><?php
print 'Please Note: You will be automatically added to my newsletter mailing list once you place your order. You may unsubscribe at any time.'; ?> </subscription_notice><?php
}
and if you want to see it in action, here’s the link to the checkout on the site. Obviously you’ll want to place an item in the cart to see it.
Well, my code is placed where I want it to be, so I know the action is correct. I’m getting a double placement of the message. Here’s the HTML Why would I be getting two copies of the subscription_notice class? My action does not say to display it twice.
<div id="order_review" class="woocommerce-checkout-review-order">
<div class="subscription_notice">Please Note: You will be automatically added to my newsletter mailing list once you place your order. You may unsubscribe at any time. </div>
<div class="subscription_notice">Please Note: You will be automatically added to my newsletter mailing list once you place your order. You may unsubscribe at any time. </div>
<table class="shop_table woocommerce-checkout-review-order-table">
<div id="payment" class="woocommerce-checkout-payment">
</div>
After a server move, which automatically solved another issue just by being in a new server setup, this issue remains.
A javascript is running which updates the order table and unfortunately runs the hook a second time. Turn off Javascript to prove.
I was able to get this to work with a different hook which runs a fraction later in the process:
add_action('woocommerce_review_order_before_payment', 'subscription_notice');
function subscription_notice() {
echo '<div class="subscription_notice ......';
}
That did it. Thank you, once again, Lorro for helping me. And thank you for the explanation. I figured there had to be something else causing that double display.
This solution worked perfectly.