WooCommerce: Add Upsell Area @ Checkout Page

If you want to increase your AOV (Average Order Value), you can definitely start from the WooCommerce Checkout page.

A client asked me to place a “Donation Area” close to the “Place Order” button (so at the bottom of the page, once customers are ready to pay) to drive more awareness around this add-on. All I had to do was creating hidden products with a donation value, use my own “Custom Add to Cart URL” guide to create add to cart links and print an HTML box right above the checkout button by using my WooCommerce Visual Hook Guide for the Checkout Page. Enjoy!

How to show an upsell / add-on area @ WooCommerce Checkout (suggesting to add more products to cart)

PHP Snippet: Show Add-Ons Area @ WooCommerce Checkout Page


  1. Product IDs you want to add to Cart (14877, 14879, 15493 in my example)
  2. No “redirect to Cart after add to cart” option checked in WooCommerce settings
 * @snippet       Upsell Area - WooCommerce Checkout
 * @how-to        Get CustomizeWoo.com FREE
 * @author        Rodolfo Melogli
 * @compatible    WooCommerce 3.6.1
 * @donate $9     https://businessbloomer.com/bloomer-armada/

add_action( 'woocommerce_review_order_before_submit', 'bbloomer_checkout_add_on', 9999 );

function bbloomer_checkout_add_on() {
	$product_ids = array( 14877, 14879, 15493 );
	$in_cart = false;
	foreach( WC()->cart->get_cart() as $cart_item ) {
	   $product_in_cart = $cart_item['product_id'];
	   if ( in_array( $product_in_cart, $product_ids ) ) {
		   $in_cart = true;
	if ( ! $in_cart ) {
		echo '<h4>Make a Donation?</h4>';
		echo '<p><a class="button" style="margin-right: 1em; width: auto" href="?add-to-cart=14877"> €5 </a><a class="button" style="margin-right: 1em; width: auto" href="?add-to-cart=14879"> €20 </a><a class="button" style="width: auto" href="?add-to-cart=15493"> €50 </a></p>';

Where to add custom code?

You should place PHP snippets at the bottom of your child theme functions.php file and CSS at the bottom of its style.css file. Make sure you know what you are doing when editing such files - if you need more guidance, please take a look at my guide "Should I Add Custom Code Via WP Editor, FTP or Code Snippets?" and my video tutorial "Where to Place WooCommerce Customization?"

Does this snippet (still) work?

Please let me know in the comments if everything went as expected. I would be happy to revise the snippet if you report otherwise (please provide screenshots). I have tested this code with Storefront theme, the WooCommerce version listed above and a WordPress-friendly hosting.

If you think this code saved you time & money, feel free to join 17,000+ WooCommerce Weekly subscribers for blog post updates and 250+ Business Bloomer supporters for 365 days of WooCommerce benefits. Thank you in advance!

Need Help with WooCommerce?

Check out these free video tutorials. You can learn how to customize WooCommerce without unnecessary plugins, how to properly configure the WooCommerce plugin settings and even how to master WooCommerce troubleshooting in case of a bug!

Rodolfo Melogli

Business Bloomer Founder

Author, WooCommerce expert and WordCamp speaker, Rodolfo has worked as an independent WooCommerce freelancer since 2011. His goal is to help entrepreneurs and developers overcome their WooCommerce nightmares. Rodolfo loves travelling, chasing tennis & soccer balls and, of course, wood fired oven pizza.

13 thoughts on “WooCommerce: Add Upsell Area @ Checkout Page

  1. How can I follow with a redirect to /checkout/. When on the ‘?add-to-cart=14877’ URL, then it cannot be removed from the cart (I have cart on checkout page) as it simply reloads the same URL and re adds the item. Clearing the query string allows the cart to be edited, however is not a user friendly approach

    1. Never mind, I figured it out. I set the original URL to ‘/cart/?add-to-cart=5489’ then add the following snippet

      add_filter('add_to_cart_redirect', 'ql_skip_cart_page');
      function ql_skip_cart_page () {
       global $woocommerce;
       $redirect_checkout = $woocommerce-&gt;cart-&gt;get_checkout_url();
       return $redirect_checkout;}
  2. Hi,

    When you click on one of the buttons you reload the checkout page and some of the fields are not kept such as order remarks.


    1. Good point Sam, but that’s not because of my snippet. Even if you move to another URL and then go back to the checkout you will lose them. There is a way to “remember” them but this is off topic

  3. Thanks for this, but how can I add it to the cart page instead of the checkout page? I’m trying to use it as upsell with one unique product for all the products in my store. Thank you

    1. Hi Cristopher, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!

  4. Thank you for the code! I have a question, how can I modify the code so that it only breaks (disappears) when all the products in the array ( $product_ids = array( 14877, 14879, 15493 ) ) are in the cart? As right now it breaks when any item is added to cart from the array. Thank you in advance, have a wonderful day!

    1. Hey Loa, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!

  5. Suppose I add a jQuery datepicker field here ( at “woocommerce_review_order_before_submit” hook ), it automatically reloads and jQuery datepicker stops working. Look as normal textbox field. Can you help me on this. This works on other hook position available at checkout page.

    1. Hey Sanesh, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!

  6. Neat tip Rodolfo 🙂

    Just want to add for variable products, you must add the variation’s ID or the user will get error notifications. Thankfully, you already told us how to do that in you article about custom add to cart URLs: https://businessbloomer.com/woocommerce-custom-add-cart-urls-ultimate-guide/

    1. Great, thanks Lionel!

Questions? Feedback? Support? Leave your Comment Now!

If you are writing code, please wrap it between shortcodes: [php]code_here[/php]. Failure to complying with this (as well as going off topic, not writing in English, etc.) will result in comment deletion. You should expect a reply in about 2 weeks - this is a popular blog but I need to get paid work done first. Please consider joining BloomerArmada to get blog comment reply priority, ask me 1-to-1 WooCommerce questions and enjoy many more perks. Thank you :)

Your email address will not be published. Required fields are marked *