Tagged: x
-
AuthorPosts
-
August 2, 2016 at 2:47 pm #1114308
tomhewettParticipantHi
in order to get a plugin working that allows me to use a quote system i have to change your code to put a quote list in the nav bar instead of a shopping cart.
To do this i have to change the orginal code (shown below):
Line 452// // Cart fragment. // if ( ! function_exists( 'x_woocommerce_navbar_cart_fragment' ) ) : function x_woocommerce_navbar_cart_fragment( $fragments ) { $fragments['div.x-cart'] = x_woocommerce_navbar_cart(); return $fragments; } add_filter( 'woocommerce_add_to_cart_fragments', 'x_woocommerce_navbar_cart_fragment' ); endif; // // Outputs a navigation item with the cart. // if ( ! function_exists( 'x_woocommerce_navbar_menu_item' ) ) : function x_woocommerce_navbar_menu_item( $items, $args ) { if ( X_WOOCOMMERCE_IS_ACTIVE && x_get_option( 'x_woocommerce_header_menu_enable' ) == '1' ) { if ( $args->theme_location == 'primary' ) { $items .= '<li class="menu-item current-menu-parent x-menu-item x-menu-item-woocommerce">' . '<a href="' . x_get_cart_link() . '" class="x-btn-navbar-woocommerce">' . x_woocommerce_navbar_cart() . '</a>' . '</li>'; } } return $items; } add_filter( 'wp_nav_menu_items', 'x_woocommerce_navbar_menu_item', 9999, 2 ); endif;And i have to replace it with
// // Cart fragment. // if ( ! function_exists( 'x_woocommerce_navbar_cart_fragment' ) ) : function x_woocommerce_navbar_cart_fragment( $fragments ) { $fragments['div.x-cart'] = x_woocommerce_navbar_cart(); return $fragments; } add_filter( 'woocommerce_add_to_cart_fragments', 'x_woocommerce_navbar_cart_fragment' ); endif; // // Outputs a navigation item with the cart. // if ( ! function_exists( 'x_woocommerce_navbar_menu_item' ) ) : function x_woocommerce_navbar_menu_item( $items, $args ) { /* if ( X_WOOCOMMERCE_IS_ACTIVE && x_get_option( 'x_woocommerce_header_menu_enable' ) == '1' ) { if ( $args->theme_location == 'primary' ) { $items .= '<li class="menu-item current-menu-parent x-menu-item x-menu-item-woocommerce">' . '<a href="' . x_get_cart_link() . '" class="x-btn-navbar-woocommerce">' . x_woocommerce_navbar_cart() . '</a>' . '</li>'; } }*/ if( class_exists('YITH_YWRAQ_Mini_List_Quote_Widget') ){ $items .= '<li class="menu-item current-menu-parent x-menu-item x-menu-item-woocommerce">'; ob_start(); $args = $defaults = array( 'title' => __( 'Quote List', 'yith-woocommerce-request-a-quote' ), 'item_name' => __( 'item', 'yith-woocommerce-request-a-quote' ), 'item_plural_name' => __( 'items', 'yith-woocommerce-request-a-quote' ), 'show_thumbnail' => 1, 'show_price' => 1, 'show_quantity' => 1, 'show_variations' => 1, ); the_widget('YITH_YWRAQ_Mini_List_Quote_Widget', $args); $items .= ob_get_clean(); $items .= '</li>'; } return $items; } add_filter( 'wp_nav_menu_items', 'x_woocommerce_navbar_menu_item', 9999, 2 ); endif;How can i put this in the functions.php of my child theme so that it works even when i’ve updated woo-commerce?
Thanks
Tom
August 2, 2016 at 4:08 pm #1114464
tomhewettParticipantPlease I need help
August 2, 2016 at 4:16 pm #1114481
Prasant RaiModeratorHello Tom,
Thanks for writing in!
A child theme is a theme that inherits the functionality of another theme, called the parent theme. Child themes allows you to modify, or add to the functionality of that parent theme instead of modifying the core theme files directly. In that regards all you need to do is place the place the code in child theme function.php file. So next time when you update WooCommerce code placed inside child theme won’t get affected. You can also walk-through our knowledgebase for more information:
https://community.theme.co/kb/how-to-setup-child-themes/
Thanks.
August 2, 2016 at 4:43 pm #1114513
tomhewettParticipantThank you didn’t realize it was that simple! thank you
August 2, 2016 at 10:50 pm #1114865
Prasant RaiModeratorYou are most welcome. 🙂
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-1114308 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
