1. Home
  2. Docs
  3. WCOP – WHMCS Cart & Order Pages
  4. Tutorials
  5. How do I embed Cart in top bar of my theme?

How do I embed Cart in top bar of my theme?

Most of the themes offer widget area’s in top-bar if that is the case you can simply place the following shortcode in top-bar/header widget area.
In case your theme does not offer a widget area where you want to display cart summary, Or you will need to edit your theme file (usually header.php) and insert one of the following codes in it an appropriate place.
 
 <?php echo do_shortcode("whcom_op_cart_summary"); ?>
 <?php echo do_shortcode("whcom_op_cart_summary type="button""); ?>
 <?php echo do_shortcode("whcom_op_cart_summary type="dropdown""); ?>

For sake of example, we are providing an example with most used theme i.e. AVADA

Following are the steps in which we will show you how to embed currency combo in top-bar

  1. Go to Appearance and click on Editor.
  2. Open the file named as header.php. Most probably the title of the file will be “Theme Header”.
  3. Paste one of the following codes into this file at the appropriate place.
     <?php echo do_shortcode("whcom_op_cart_summary"); ?>
     <?php echo do_shortcode("whcom_op_cart_summary type="button""); ?>
     <?php echo do_shortcode("whcom_op_cart_summary type="dropdown""); ?>
  4. Click on Update File to save changes.
  5. Open any page of your website to see how this code worked.

more information on do_shortcode function of WordPress can be found here

Was this article helpful to you? Yes No 8