Checkout

WooCommerce Checkout Upsell Checkbox

Pre-Requisites

You’ll need the Product ID of the product you wish to link to and upsell.

How To Implement This Solution?

Simply copy the pre-coded solution to your active theme’s functions.php or preferably the Code Snippets Plugin.

About This Solution

Do you want to be able to upsell products on the WooCommerce checkout without any bloated, expensive plugins? This quick guide shows you how to upsell a product at the checkout stage of the buying journey by implementing a checkbox which adds a product of your choice to the order. Simple replace the product ID in the code with your product ID of choice and change the text as necessary. We recommend making the upsell product a hidden, discounted product so that the upsell offer is more appealing and true in that it is a one-time offer only.

/**
 * Snippet Name:     Add custom hidden_product_upsell at WooCommerce checkout
 * Snippet Author:   ecommercehints.com
 */

add_action( 'woocommerce_review_order_before_submit', 'ecommercehints_hidden_product_upsell_checkbox' );
add_action( 'woocommerce_checkout_order_processed', 'ecommercehints_hidden_product_upsell_something', 9, 3 );

function ecommercehints_hidden_product_upsell_checkbox() {
   echo '<p class="form-row">
      <label class="woocommerce-form__label woocommerce-form__label-for-checkbox checkbox">
         <input type="checkbox" class="woocommerce-form__input woocommerce-form__input-checkbox input-checkbox" name="ecommercehints_hidden_product_upsell">
         <span>Today\'s Offer - get <a href="UPSELL_PRODUCT_URL_HERE" target="_blank">the belt to match</a> for just £55!</span>
      </label>
   </p>';
}

function ecommercehints_hidden_product_upsell_something( $order_id, $posted_data, $order ) {
   if( isset( $_REQUEST['ecommercehints_hidden_product_upsell'] ) && $_REQUEST['ecommercehints_hidden_product_upsell'] == 'on' ) {
      $product = wc_get_product( 15 ); // The product ID you would like to upsell
      $order->add_product( $product );
      $order->calculate_totals();
   }
}

Snippet Benefits

  • Increase you AOV (Average Order Value) by upselling products on the checkout page with a simple checkbox.

100 WooCommerce Conversion Rate Optimisation Tips

This field is for validation purposes and should be left unchanged.

Let’s collaborate!

Need to outsource WordPress development?

Join forces with UnlimitedWP for an outsourced white label web development service you can truly rely on.

First Timer Here?

Sign up to receive 10% off on your first month with us.

26027
WELCOME OFFER