Are you a GenerateCustomer?

Do you have an active GP Premium or GenerateBlocks Pro license key?

Create a GenerateSupport account for GeneratePress and GenerateBlocks support in one dedicated place.

Create an account
Already have a GenerateSupport account? Login

Just browsing?

Feel free to browse the forums. Support for our free versions is provided on WordPress.org (GeneratePress, GenerateBlocks).

Want to become a premium user? Learn more below.

Cart icon and mini cart

  • Hi, I would like to create a top bar menu with search icon, cart icon and profile icon, simmilar as on your decor starter site, but would like the icons to be in the top bar instead of Moj račun and košarica. The site is https://7fit.hr/naslovna/
    Can you help me out plese.
    Tnx in advance.

  • Hi there,

    First, add this snippet:

    add_shortcode( 'gp_wc_cart', function() {
    
        if ( ! function_exists( 'generatepress_wc_cart_link' ) || ! class_exists( 'WooCommerce' ) ) {
            return '';
        }
    
        $has_items = '';
        if ( ! WC()->cart->is_empty() ) {
            $has_items = 'has-items';
        }
    
        return sprintf(
            '<div class="wc-menu-item %2$s %3$s">%1$s</div>',
            generatepress_wc_cart_link(),
            is_cart() ? 'current-menu-item' : '',
            esc_attr( $has_items )
        );
    
    });

    Adding PHP: https://docs.generatepress.com/article/adding-php/

    Once the snippet is added, edit the Top Bar Element, insert a Shortcode block, and add this shortcode:

    
    [gp_wc_cart]
    
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.