rubinh0
Forum Replies Created
-
Forum: Plugins
In reply to: [WooCommerce] how to add cart icon in headim a total loser with coding > php
but maybe what we want could be done like this:
1- create a widget area
2- position widget area into theme > heading
3- insert data inside the widget area. the data = load woocommerce variables and echo it.
—-
1 to 2 = https://www.themesandco.com/snippet/add-widget-area-header/
3 = we should find a way to know how to: add content into a widget area (with ‘id’ => ‘customname’ ) using functions hooks.
and in that function we could add woocommerce variables
global $woocommerce; // get cart quantity $qty = $woocommerce->cart->get_cart_contents_count(); // get cart total $total = $woocommerce->cart->get_cart_total(); // get cart url $cart_url = $woocommerce->cart->get_cart_url(); // if multiple products in cart if($qty>1) echo '<a id="cart_in_menu_11" class="cart_is_in_menu" href="'.$cart_url.'">'.$qty.' products | '.$total.'</a>'; // if single product in cart if($qty==1) echo '<a id="cart_in_menu_1" class="cart_is_in_menu" href="'.$cart_url.'">1 product | '.$total.'</a>';
Forum: Plugins
In reply to: [WooCommerce] how to add cart icon in headyavarkhan
you want the cart to go into a extra.widget area. that is located in the header?
Forum: Plugins
In reply to: [WooCommerce] how to add cart icon in head// addd cat in header add_filter('wp_nav_menu_items','add_cart_in_menu', 10, 2); function add_cart_in_menu( $menu, $args ) { if( $args->theme_location == 'primary') {global $woocommerce; // get cart quantity $qty = $woocommerce->cart->get_cart_contents_count(); // get cart total $total = $woocommerce->cart->get_cart_total(); // get cart url $cart_url = $woocommerce->cart->get_cart_url(); // if multiple products in cart if($qty>1) echo '<a class="cart_is_in_menu" href="'.$cart_url.'">'.$qty.' products | '.$total.'</a>'; // if single product in cart if($qty==1) echo '<a class="cart_is_in_menu" href="'.$cart_url.'">1 product | '.$total.'</a>'; } return $menu; }
is this bit of code correct?
Forum: Plugins
In reply to: [WooCommerce] how to add cart icon in headhey guys ??
have a question.
how can i add those cart info inside the Heading in unique div?. in a way that its not inside the nav.ul.li
like
<heading>
<brand> <nav.ul.li> <cart>
</heading>