Navigation
This is archived content. Visit our new forum.
  • Author
    Posts
  • #740988

    quinex
    Participant

    Hi

    I would like to move the woocommerce cart that is displayed in the nav menu upon activation (see image attached) to the top bar… what do i need to change in files to accomplish that?

    Thanks a lot

    Cheers carlo

    #741008

    Prasant Rai
    Moderator

    Hello Carlo,

    Thanks for writing in! To assist you with this issue, we’ll first need you to provide us with your URL. This is to ensure that we can provide you with a tailored answer to your situation. Once you have provided us with your URL, we will be happy to assist you with everything.

    Thanks.

    #741061

    quinex
    Participant

    Hi

    i have my site in a developing subdomain… it is online but dns is not pointing to it so it is hidden for everyone…

    i could give you details so you can add it to terminal (mac) or something so you can check it…

    please let me know

    #741116

    Rupok
    Member

    Hi there,

    Thanks for updating! X WooCommerce cart button is specifically to appear in the Navbar. It could be possible to show it in the Topbar with custom development, but it would fall beyond the scope of support we can provide. You may wish to consult a developer to assist you with this. X is quite extensible with child themes, so there are plenty of possibilities.

    Thanks for understanding.

    #741133

    quinex
    Participant

    i will search in this forum because i have seen it somewhere here but can’t track it anymore…

    something with a shortcode and another post adding something to topbar.pgp

    #741197

    Rupok
    Member

    Hi there,

    Thanks for updating! Maybe you are referring this thread – https://community.theme.co/forums/topic/add-cartmy-account-woocommerce-into-top-bar/
    You can follow this if you are ready to go for some custom development. However we can’t guarantee anything about the suggested code there as it’s a pretty old thread and won’t be able to assist you on this.

    Cheers!

    #742290

    quinex
    Participant

    I couldn’t find the info needed in there… as you said it’s an old post and already showed that the shortcode plugin wouldn’t work.

    also the less plugins he better 😉

    for sure there has to be a code somewhere that adds the cart button (the one that gets activated in nav bar by checking the option in customizer…with amount and item number) to the nav bar?

    If you maybe could tell me where to find it i could maybe try to get it in topbar.php?

    #742361

    Christopher
    Moderator

    Hi there,

    Copy _topbar.php from framework/views/global and put it in the same path inside child theme, replace existing code with following :

    <?php
    
    // =============================================================================
    // VIEWS/GLOBAL/_TOPBAR.PHP
    // -----------------------------------------------------------------------------
    // Includes topbar output.
    // =============================================================================
    
    ?>
    
    <?php if ( x_get_option( 'x_topbar_display' ) == '1' ) : ?>
    
      <div class="x-topbar">
        <div class="x-topbar-inner x-container max width">
          <?php if ( x_get_option( 'x_topbar_content' ) != '' ) : ?>
          <p class="p-info"><?php echo x_get_option( 'x_topbar_content' ); ?></p>
          <?php endif; ?>
          <?php x_social_global(); ?>
          <ul class="x-nav">
       <li class="menu-item current-menu-parent x-menu-item x-menu-item-woocommerce">
     <a href="<?php x_get_cart_link(); ?>" class="x-btn-navbar-woocommerce">
      <?php echo (x_woocommerce_navbar_cart()); ?>
       </a>
       </li>
       </ul>
        </div>
      </div>
    
    <?php endif; ?>

    Hope it helps.

    #742379

    quinex
    Participant

    Hi

    yep, that made it show in top bar 😉

    2 (minor) issues … how come the amount shows 3 digits after the ,? so instead of € 0,00 it shows € 0,000

    i configured 2 dig’s in woocommerce…does it not pick it up somehow?

    Also when clicking it it stays on same page… so i guess the get cart link doesn’t activate somehow

    edit: hahahahaha… i was looking a bit crosseyed here… the 3 digits is my mistake it says €0,000 items… so the 3rd 0 belongs to items… didn’t style it yet so it is without any styling.

    #742459

    Paul R
    Moderator

    Hi,

    Would you mind providing us with login credentials so we can take a closer look? To do this, you can make a post with the following info:

    – Link to your site
    – WordPress Admin username / password
    – FTP credentials

    Don’t forget to select Set as private reply. This ensures your information is only visible to our staff.

    #742590

    quinex
    Participant
    This reply has been marked as private.
    #742604

    quinex
    Participant

    Hi

    Before you proceed… my son just came home and had a look at it and suggested a small addition:

    Instead of:

    
     <ul class="x-nav">
       <li class="menu-item current-menu-parent x-menu-item x-menu-item-woocommerce">
     <a href="<?php x_get_cart_link(); ?>" class="x-btn-navbar-woocommerce">
      <?php echo (x_woocommerce_navbar_cart()); ?>
       </a>
       </li>
       </ul>
    
    Use  <ul class="x-nav">
       <li class="menu-item current-menu-parent x-menu-item x-menu-item-woocommerce">
     <a href="<?php echo x_get_cart_link(); ?>" class="x-btn-navbar-woocommerce">
      <?php echo (x_woocommerce_navbar_cart()); ?>
       </a>
       </li>
       </ul>
    

    so before x_get_cart_link add “echo” … that worked.

    #742685

    Thai
    Moderator

    Glad you’ve sorted it out.

    If you need anything else, please let us know 🙂

    #742722

    quinex
    Participant

    I will.. thanks for all the great help!!

    #742753

    Prasant Rai
    Moderator

    You are most welcome. 🙂