Related products for WooCommerce plugin by WebToffee allows you to display related product recommendations on your product pages. This strategic method can greatly enhance user experience, increase cross-selling opportunities, boost average order value, and drive more sales and revenue. Additionally, the plugin offers several other perks. In this article, we will explain how you can easily showcase related product recommendations on your checkout page with the help of a code snippet.
Set up related products
To begin with, once the plugin is installed and activated:
- From the WordPress dashboard, navigate to WooCommerce > Related products.
- Configure the Related product recommendations as you prefer.
- You can choose to display the default related product recommendation provided by WooCommerce, or You can set a customized version of the recommendation.
- Save your changes.
Display related products on checkout
To display the related product recommendations on the checkout page, you can use the below-provided code snippet in your theme’s functions.php file. To do so,
- Navigate to Appearance > Theme File Editor > functions.php file from the WordPress dashboard.
- Copy the code snippet provided below.
- Paste the code snippet into the bottom of the functions.php file.
- Save the functions.php file.
- Alternatively, if you can’t find the functions.php file for your theme, refer to this article to learn how to add the code snippet to your store.
Code snippet
Once the snippet is added successfully, the related products recommendation will be displayed on the checkout page as shown.
The provided code snippet showcases related products on the checkout page after the checkout form. If you prefer to place them in a different location on the checkout page other than after the checkout form, you can replace the following action hook in the code snippet, woocommerce_after_checkout_form
, with one of your choice.
You can refer to the following article to explore different action hooks available on the checkout page and change the position as per your preference: WooCommerce Visual Hook Guide – Checkout Page.