Cart in menu - by kordicpetar - on WordPress WooCommerce support

This topic has 6 replies, 3 voices, and was last updated 7 years, 6 months ago ago by Jack Richardson

  • Avatar: kordicpetar
    kordicpetar
    Participant
    September 29, 2016 at 15:51

    Hi there,

    I am working on your theme, and I have to say that it is great! I have one problem that I tried to fix with plugin but it caused some problem.

    I need to add cart in menu like it si now on my test site http://www.test.cia.rs. Problem now is that I achieved this with plugin Menu Cart Pro. Problem is that when I add something to cart, it do not live update it, so people can be confused.

    Can you please help me?

    5 Answers
    Avatar: Eva
    Eva Kemp
    Support staff
    September 29, 2016 at 16:46

    Hello,

    Please take our apologies but we don’t provide support for 3rd-party plugins and don’t guarantee their full compatibility with the theme.

    Regards,
    Eva Kemp.

    Avatar: kordicpetar
    kordicpetar
    Participant
    September 29, 2016 at 16:54

    You did not understood me, I do not want to use that plugin at all. I just want to move cart that is integral part of Legenda theme inside main menu.

    So I want to erase plugin, and not to use it.

    Avatar: Eva
    Eva Kemp
    Support staff
    September 29, 2016 at 16:56

    Hello,

    We don’t have such option to move cart widget to the menu. It requires additional customization. If you agree with it please contact our customization service via this form https://www.8theme.com/customization-services/ .

    Regards,
    Eva Kemp.

    Avatar: kordicpetar
    kordicpetar
    Participant
    September 30, 2016 at 10:17

    Ok how about this, I am asking you to help me with finding out where did I get wrong? It should work when I add it to function.php, but it does not. Do you maybe know where is the mistake?

    Sorry but my budget is quite low and I can not take custom support. 🙁

    <?php
    add_filter( ‘wp_nav_menu_items’, ‘my_wp_nav_menu_items’, 10, 2 );
    function my_wp_nav_menu_items( $items, $args, $ajax = false ) {
    // Top Navigation Area Only
    if ( ( isset( $ajax ) && $ajax ) || ( property_exists( $args, ‘theme_location’ ) && $args->theme_location === ‘top_nav’ ) ) {
    // WooCommerce
    if ( class_exists( ‘woocommerce’ ) ) {
    $css_class = ‘menu-item menu-item-type-cart menu-item-type-woocommerce-cart’;
    // Is this the cart page?
    if ( is_cart() )
    $css_class .= ‘ current-menu-item’;
    $items .= ‘<li class=”‘ . esc_attr( $css_class ) . ‘”>’;
    $items .= ‘cart->get_cart_url() ) . ‘”>’;
    $items .= wp_kses_data( WC()->cart->get_cart_total() ) . ‘ – <span class=”count”>’ . wp_kses_data( sprintf( _n( ‘%d item’, ‘%d items’, WC()->cart->get_cart_contents_count(), ‘simple-shop’ ), WC()->cart->get_cart_contents_count() ) ) . ‘</span>’;
    $items .= ‘
    ‘;
    $items .= ‘‘;
    }
    // Easy Digital Downloads
    else if ( class_exists( ‘Easy_Digital_Downloads’ ) ) {
    $css_class = ‘menu-item menu-item-type-cart menu-item-type-edd-cart’;
    // Is this the cart page?
    if ( edd_is_checkout() )
    $css_class .= ‘ current-menu-item’;
    $items .= ‘<li class=”‘ . esc_attr( $css_class ) . ‘”>’;
    $items .= ‘‘;
    $items .= wp_kses_data( edd_cart_subtotal() ) . ‘ – <span class=”count”>’ . wp_kses_data( sprintf( _n( ‘%d item’, ‘%d items’, edd_get_cart_quantity(), ‘simple-shop’ ), edd_get_cart_quantity() ) ) . ‘</span>’;
    $items .= ‘
    ‘;
    $items .= ‘‘;
    }
    }
    return $items;
    }
    /**
    * This function updates the Top Navigation WooCommerce cart link contents when an item is added via AJAX.
    */
    add_filter( ‘woocommerce_add_to_cart_fragments’, ‘my_woocommerce_add_to_cart_fragments’ );
    function my_woocommerce_add_to_cart_fragments( $fragments ) {
    // Add our fragment
    $fragments[‘li.menu-item-type-woocommerce-cart’] = my_wp_nav_menu_items( ”, new stdClass(), true );
    return $fragments;
    }

    Avatar: Jack Richardson
    Jack Richardson
    Support staff
    October 3, 2016 at 08:54

    Hello,

    As we told you this is beyond our basic support scope. You have to contact our customization service https://www.8theme.com/customization-services/ .

    Thank you for understanding.

    Best regards,
    Jack Richardson.

  • Viewing 6 results - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.Log in/Sign up

We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.