Tagged: Cart, hook, shipping, woocommerce
-
AuthorPosts
-
December 12, 2023 at 4:17 pm #1427885
Hello there,
i tried to insert individual text after the shipping rates in cart page.
Link to image where i show on which position the text should appear: https://cloud.boehm.media/index.php/s/eCiPLPnZiJwMekKSo i tried to use the hook “woocommerce_cart_totals_after_shipping” (as mentioned in the visual hook page of: https://www.businessbloomer.com/woocommerce-visual-hook-guide-cart-page/).
Unfortunately it appears on top of the shipping section :-(
This is the result: (Link to image) https://cloud.boehm.media/index.php/s/cyuPC0lHch6XKjKI hope, you can name me the right hook.
Thanks a lot
Kind regards
BerndDecember 13, 2023 at 6:01 pm #1428027Hey boehmmedia,
I believe that you do have the right hook, but that you have not added any html tags to add text into the table, since I assume that your function looks something like this with just plan text:add_action('woocommerce_cart_totals_after_shipping', 'why_pay_shipping'); function why_pay_shipping() { if (WC()->cart->cart_contents_total) { echo '▸ Warum bezahle ich Versandkosten'; } }and you are getting this result:

to add the text into the table you need to add a table tag like this:add_action('woocommerce_cart_totals_after_shipping', 'why_pay_shipping'); function why_pay_shipping() { if (WC()->cart->cart_contents_total) { echo '<td colspan="2" style="text-align:center;">▸ Warum bezahle ich Versandkosten</td>'; } }this is the new result:

please give this a try.Best regards,
MikeDecember 14, 2023 at 8:31 am #1428058Hi Mike,
thanks a lot for help :-) and sorry, that i doesn’t share my code :-(
As i want to illustrate my issue i forget to copy the code into the post :-(With your help now it works. I have not realised that the shipping fees are ordered in a table.
Your code works fine.Kind regards
BerndDecember 14, 2023 at 8:48 am #1428061 -
AuthorPosts
- The topic ‘Hook for Woocommerce Cart Page after Shipping’ is closed to new replies.
