Add-on development: add the cart icon to the end of the main navigation menu

I am using a custom theme and I want to add a cart icon to the main navigation menu. This is my site

I used the theme_location to select the main navigation as defined in my functions.php in my main theme, however, the main menu must have been used twice on the same page in my theme. How can i fix this?

// Add Font Awesome to site.
add_action( 'wp_enqueue_scripts', 'dcwd_include_font_awesome_css' );
function dcwd_include_font_awesome_css() {
    // Enqueue Font Awesome from a CDN.
    wp_enqueue_style( 'font-awesome-cdn', '' );

// Style the cart count number.
add_action( 'wp_head', 'dcwd_cart_count_styles' );
function dcwd_cart_count_styles() {

theme_location == 'Primary Navigation')
            $cart_item_count = WC()->cart->get_cart_contents_count();
            $cart_count_span = '';
            if ( $cart_item_count ) {
                $cart_count_span = ''.$cart_item_count.'';
    $cart_link = '
  • '.$cart_count_span.'
  • '; // Add the cart link to the end of the menu. $items = $items . $cart_link; return $items; }


    I want to show the cart only in the main navigation menu at the top, and not below the image slider.