[Support request] Suggestion – WooCommerce cart menu icon location

Home Forums Support Suggestion – WooCommerce cart menu icon location

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #463125
    Simon

    Hi,

    I have a suggested change/improvement for you:

    In Customizer -> Layout -> WooCommerce -> General the cart menu option could have a primary/secondary menu choice.

    I have implemented it in my installation as follows:

    Insert this code at line 81 of \generatepress_pro\woocommerce\functions\customizer\customizer.php

    
    $wp_customize->add_setting(
      'generate_woocommerce_settings[cart_menu_item_sec]',
      array(
        'default' => $defaults['cart_menu_item_sec'],
        'type' => 'option',
        'sanitize_callback' => 'generate_premium_sanitize_checkbox'
      )
    );
    
    $wp_customize->add_control(
      'generate_woocommerce_settings[cart_menu_item_sec]',
      array(
        'type' => 'checkbox',
        'label' => __( 'Use secondary menu for cart icon', 'generate-woocommerce' ),
        'section' => 'generate_woocommerce_layout',
        'settings' => 'generate_woocommerce_settings[cart_menu_item_sec]',
      )
    );
    

    And change line 307 of \generatepress_pro\woocommerce\functions\functions.php to:

    
    if ( $args->theme_location == apply_filters( 'generate_woocommerce_menu_item_location', generatepress_wc_get_setting( 'cart_menu_item_sec' ) ? 'secondary' : 'primary' ) && generatepress_wc_get_setting( 'cart_menu_item' ) ) {
    

    Also, maybe a small typo: line 306 of the same file says:
    // If our primary menu is set, add the search icon

    Surely it should say:
    // If our primary menu is set, add the cart icon

    Simon

    GeneratePress 2.0.1
    GP Premium 1.5.6
    #463529
    Tom
    Lead Developer
    Lead Developer

    Yea, this is an option we plan on adding.

    Instead of altering that core code, you can just do this:

    add_filter( 'generate_woocommerce_menu_item_location', 'tu_move_menu_cart_item' );
    function tu_move_menu_cart_item() {
        return 'secondary';
    }

    Thanks!

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