My Courses > CustomizeWoo > Module 4 > Lesson 09: Checkout Page: ADD Content
Checkout Page: ADD Content
This is how to add content to the checkout page by using the visual hook guide. Always start from displaying some simple “TEXT” in the correct position, and then make your functions more complex. A little win is better than hours spent troubleshooting.
Video
Please note: English captions are enabled by default (click on “CC” in the video player to disable). Also, you can click on the “gear” icon to manage quality and playback speed. Enjoy!
If you joined already, please log in.
Otherwise, here is why you should join the Club.
Useful Links
WooCommerce Visual Hook Guide: Checkout Page
Related Snippets
WooCommerce: Add Upsell Area @ Checkout Page
WooCommerce: How to Add Scripts to the Checkout Page
WooCommerce: Add Shipping Notices on Checkout Page
WooCommerce: Add Content Under โPlace Orderโ Button @ Checkout
WooCommerce: Display Order Delivery Date @ Checkout
WooCommerce: Display Product-Specific T&C @ Checkout
WooCommerce: Display Weight @ Cart & Checkout
WooCommerce: Add Privacy Policy Checkbox @ Checkout
Hello, Rodolfo!
I would like the “Submit order” button in the checkout page to have a different text depending on which product category is already in the cart. For example: If the product in the cart belongs to the “Albums” category, the “Submit Order” button in checkout should have the text “Submit Albums”. If the product in the cart belongs to the “Music” product category, the “Submit Order” button should have the text “Submit Music”. These are just examples so you can understand what I want. If there are multiple categories in the cart, the button with the text “Submit Order” does not change. Please give me a hint how to start this customization.
Hello Marcel, great question! You would start with https://www.businessbloomer.com/woocommerce-rename-place-order-button-checkout/, see if that works in the first place. After that, you can use some of the https://www.businessbloomer.com/woocommerce-check-product-category-cart/ code to see if there is a specific category in the Cart. Good luck!
Hi, Rodolfo. Here is the code I wrote and it works partially.
I mean if in the cart are only products from the category “Music”, I have the text “Submit music” – as I want.
If in the cart are only products from the category “Albums”, I have the text “Submit albums” – as I want.
If in the cart are only products from any other category, BUT NOT “Music” or “Albums”, I have the text “Submit Order” – as I want.
The problem is when I mix them.
What to do when I have products from different categories in the cart to have the button with the text “Submit Order”?
Hi Marcel!
1) in the foreach you’re using “break”, which exits from the foreach in case one category is returned. Remove both.
2) in the following if/elseif/else you should check first if both categories are in the cart, so that should become if/elseif/elseif/else
Hope this helps!
Stucked here: “check first if both categories are in the cart”.
How exactly should I write a statement if 2 or more categories are in the cart?
I know how to do it for one, but for more?
Thank you!
Like this:
Perfect. Thank you. I’d like to go a little further and add one more condition, this time for a specific product from a category other than “Albums” or “Music”.
How do I write this statement to include verification of both a product category and a product ID?
For checking a product category in the cart I use:
To verify a product ID in the cart I use
Hey Marcel!
If I understand well, you’d use e.g.: