Cart Menu in Woocommerce

This is my woocommerce page , screenshot>> http://prntscr.com/jegqcp

The woocommerce page is the same menu as the cart menu (where cart is supposed to be shown

i have set this code in functions.php
function custom_blog_menu( $args ) {
if ( is_woocommerce() ) {
$args[‘theme_location’] = ‘Store Menu’;
$args[‘menu’] = ‘Store Menu’;
}
return $args;
}

and this code in wpheader.php in the x-child theme

<?php // ============================================================================= // VIEWS/ETHOS/WP-HEADER.PHP // ----------------------------------------------------------------------------- // Header output for Ethos. // ============================================================================= ?> <?php x_get_view( 'global', '_header' ); ?> <?php x_get_view( 'global', '_slider-above' ); ?> <?php x_get_view( 'ethos', '_post', 'carousel' ); ?> <?php x_get_view( 'global', '_topbar' ); ?> <?php x_get_view( 'global', '_navbar' ); ?>
  <div id="custom-fixed-menu">
  <?php if (x_is_shop()) : ?> 
    <?php ubermenu( '5776' , array( 'theme_location' => 'secondary-menu' ) ); ?>
  <?php else : ?>
    <?php ubermenu( '5776' , array( 'theme_location' => 'secondary-menu' ) ); ?>
  <?php endif; ?>
</div>

<?php x_get_view( 'ethos', '_breadcrumbs' ); ?>
<?php x_get_view( 'global', '_slider-below' ); ?> <?php x_get_view( 'ethos', '_landmark-header' ); ?>

i dont know how its related, but do you have anyidea how can i show cart menu on the side where it shows the same menu?

Hello There,

Thanks for posting in! The code in your functions.php file does not do anything. The custom fixed menu on the other displays the same menu inside both of the condition so this does not do any difference as well. What are the names or IDs of your menus? There should be a different ID for the cart menu. For example:

If woocommerce shop page
  display cart menu
else
  display the default menu

Hope this make sense.

Hello,
what i ment is that i want to display cart menu on theme location “cart” when shop is on.
how can this be done please?

Hi there,

Based on the code you have added from your first response, you have not added the cart menu anywhere on the code yet.

To display a menu added to the menu location you have created, you will have to use wp_nav_menu().

Please refer to from this link:

https://developer.wordpress.org/reference/functions/wp_nav_menu/

Then the in the wp-header.php should have something like:

<?php if (x_is_shop()) : ?> 
    <?php
        wp_nav_menu( array( 
            'theme_location' => 'cart-menu', 
            'container_class' => 'custom-menu-class' ) ); 
    ?>
<?php endif; ?>

On the code above, the line 'theme_location' => 'cart-menu', indicates that you are adding the menu that is assigned to the cart-menu theme location you have registered using register_nav_menu so kindly update the theme location slug if you used a different value to the cart menu location slug.

Also, if you are using this code to achieve what you are currently aiming to do:

<div id="custom-fixed-menu">
  <?php if (x_is_shop()) : ?> 
    <?php ubermenu( '5776' , array( 'theme_location' => 'secondary-menu' ) ); ?>
  <?php else : ?>
    <?php ubermenu( '5776' , array( 'theme_location' => 'secondary-menu' ) ); ?>
  <?php endif; ?>
</div>

This will display not make any difference because it will display the same menu which is what is assigned to the secondary-menu as what was mention by @RueNel, try changing the theme location value of the code closest to the if statement to the cart menu slug instead.

At present, your site already has a lot of code customization which causes a lot of complication when you have not added the customizations correctly. We encourage you to get in touch with a developer if you are not comfortable making the changes yourself and this would help you in the long run if your site’s customization is done by a professional.

Hope this helps you get started.

1 Like

Hey!

i didnt quiet understood you.

i have a Store menu and a Cart menu,
The 5776 Menu is not relevant. i actualy want the cart menu to be placed in the 5776 menu place.

Screenshot>> http://prntscr.com/jevfw3

but when i click links on the Store Menu, then on the directions of the links the Store Menu is gone and the normal nav menu appears again.

my questions are:

  1. How do i set the Store menu to appear in all the store and woocommerce links on the store menu
  2. how to i place cart menu instead of the 5776 menu position?

P.S:

I do have cart menu set up and theme location as well as the Store menu

Screenshot>> http://prntscr.com/jevhc3

Please help, its my last issue

Hey @angelofgod,

In this case, you would need to hire a third party developer to make use of @Jade’s suggestion as this would be getting into custom development which is outside the scope of our support.

Thank you for understanding.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.