generate_woocommerce_menu_item_location

The generate_woocommerce_menu_item_location allows you to change where the WooCommerce cart icon is displayed. If you want the cart icon from primary menu to secondary menu, try this PHP snippet below:

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