本文整理汇总了PHP中woocommerce_mini_cart函数的典型用法代码示例。如果您正苦于以下问题:PHP woocommerce_mini_cart函数的具体用法?PHP woocommerce_mini_cart怎么用?PHP woocommerce_mini_cart使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了woocommerce_mini_cart函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: shopping_cartdropdown
function shopping_cartdropdown()
{
if (class_exists('WooCommerce')) {
global $woocommerce;
?>
<div class="top-cart dropdown text-right">
<i class="pull-right fa fa-shopping-cart"></i>
<h3 class="cart">
<?php
echo __('Shopping Cart', TEXTDOMAIN);
?>
</h3>
<a class="dropdown-toggle cart-contents" href="#" data-toggle="dropdown" data-hover="dropdown" data-delay="0" title="<?php
_e('View your shopping cart', 'woothemes');
?>
">
<?php
echo sprintf(_n('%d item', '%d items', $woocommerce->cart->cart_contents_count, 'woothemes'), $woocommerce->cart->cart_contents_count);
?>
- <?php
echo $woocommerce->cart->get_cart_total();
?>
</a>
<div class="dropdown-menu">
<?php
woocommerce_mini_cart();
?>
</div>
</div>
<?php
}
}
示例2: get_refreshed_fragments
/**
* Get a refreshed cart fragment
*/
public static function get_refreshed_fragments()
{
// Get mini cart
ob_start();
woocommerce_mini_cart();
$mini_cart = ob_get_clean();
// Fragments and mini cart are returned
$data = array('fragments' => apply_filters('add_to_cart_fragments', array('div.widget_shopping_cart_content' => '<div class="widget_shopping_cart_content">' . $mini_cart . '</div>')), 'cart_hash' => WC()->cart->get_cart() ? md5(json_encode(WC()->cart->get_cart())) : '');
wp_send_json($data);
}
示例3: kt_get_refreshed_fragments
function kt_get_refreshed_fragments($fragments)
{
// Get mini cart
ob_start();
woocommerce_mini_cart();
$mini_cart = ob_get_clean();
// Fragments and mini cart are returned
$fragments['div.kt-header-mini-cart-refreash'] = '<div class="kt-header-mini-cart-refreash">' . $mini_cart . '</div>';
return $fragments;
}
示例4: woocommerce_get_refreshed_fragments
/**
* woocommerce_get_refreshed_fragments function.
*
* @access public
* @return void
*/
function woocommerce_get_refreshed_fragments()
{
global $woocommerce;
header('Content-Type: application/json; charset=utf-8');
// Get mini cart
ob_start();
woocommerce_mini_cart();
$mini_cart = ob_get_clean();
// Fragments and mini cart are returned
$data = array('fragments' => apply_filters('add_to_cart_fragments', array('div.widget_shopping_cart_content' => '<div class="widget_shopping_cart_content">' . $mini_cart . '</div>')), 'cart_hash' => $woocommerce->cart->get_cart() ? md5(json_encode($woocommerce->cart->get_cart())) : '');
echo json_encode($data);
die;
}
示例5: widget
/**
* Outputs the HTML for this widget.
*
* @param array $args An array of standard parameters for widgets in this theme
* @param array $instance An array of settings for this widget instance
*
* @return void Echoes it's output
*/
public function widget($args, $instance)
{
if (!function_exists('is_woocommerce')) {
return;
}
global $woocommerce;
$instance = wp_parse_args($instance, $this->defaults);
extract($args);
if ($title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base)) {
echo $before_title . esc_html($title) . $after_title;
}
echo $before_widget;
?>
<div class="mini-cart">
<a href="<?php
echo esc_url($woocommerce->cart->get_cart_url());
?>
" class="cart-contents" title="<?php
esc_attr_e('View your shopping cart', 'bigboom');
?>
">
<i class="fa fa-shopping-cart"></i>
<span class="mini-cart-counter"><?php
echo intval($woocommerce->cart->cart_contents_count);
?>
<span><?php
_e('item(s)', 'bigboom');
?>
</span></span>
- <?php
echo $woocommerce->cart->get_cart_total();
?>
<span class="arrow"><i class="fa fa-arrow-right"></i></span>
</a>
<div id="mini-cart-content" class="mini-cart widget_shopping_cart_content"><?php
woocommerce_mini_cart();
?>
</div>
</div>
<?php
echo $after_widget;
}
示例6: circleflip_wc_mini_cart
function circleflip_wc_mini_cart($args = array())
{
?>
<div id="cf-mini-cart" class="cart-dropdown <?php
echo sizeof(WC()->cart->get_cart()) > 0 ? 'cart-has-items' : 'cart-is-empty';
?>
">
<div class="cart-dropdown-header">
<span class="icon-basket-1"></span>
</div>
<div class="cart-dropdown-elements">
<?php
woocommerce_mini_cart($args);
?>
</div>
</div>
<?php
}
示例7: thb_woo_cart
function thb_woo_cart()
{
global $woocommerce, $cart_class;
if (thb_check_minicart_display() == false) {
return;
}
echo "<div class='thb-mini-cart-icon " . $cart_class . "'>";
echo "<span class='thb-product-numbers'>" . $woocommerce->cart->cart_contents_count . "</span>";
echo "<a href='" . $woocommerce->cart->get_cart_url() . "' id='thb-cart-trigger'>a</a>";
echo "<div class='thb_mini_cart_wrapper'>";
echo "<div class='widget_shopping_cart_content'>";
woocommerce_mini_cart();
echo "</div>";
echo "</div>";
echo "</div>";
}
示例8: etheme_top_cart
function etheme_top_cart($load_cart = false)
{
global $woocommerce;
?>
<div class="shopping-container" <?php
if (etheme_get_option('favicon_badge')) {
echo 'data-fav-badge="enable"';
}
?>
>
<div class="shopping-cart-widget" id='basket'>
<a href="<?php
echo esc_url($woocommerce->cart->get_cart_url());
?>
" class="cart-summ" data-items-count="<?php
echo $woocommerce->cart->cart_contents_count;
?>
">
<div class="cart-bag">
<i class='ico-sum'></i>
<?php
et_cart_number();
?>
</div>
<?php
et_cart_total();
?>
</a>
</div>
<div class="cart-popup-container">
<div class="cart-popup">
<?php
if ($load_cart) {
woocommerce_mini_cart();
} else {
echo '<div class="widget_shopping_cart_content"></div>';
}
?>
</div>
</div>
</div>
<?php
}
示例9: woocommerce_mini_cart
<?php
/*
Istället för att kundvagnen skall läggas till
som en widget så skrivs widgeten ut här automatiskt.
(Förutsatt att WooCoomerce finns installerad)
*/
if ( class_exists( 'WooCommerce' ) ) {
?>
<div class="sidebar-widget kundvagn-widget">
<div id="woocommerce_widget_cart-3" class="woocommerce widget_shopping_cart">
<h3>Your Cart</h3>
<div class="hide_cart_widget_if_empty"><div class="widget_shopping_cart_content">
<? woocommerce_mini_cart( $args );?>
</div>
</div></div>
</div>
<? } ?>
<div class="sidebar-widget">
<?php if(!function_exists('dynamic_sidebar') || !dynamic_sidebar('sidebar-1')) ?>
</div>
<a href="http://www.seydel1847.de/"><img src="<?=get_template_directory_uri();?>/img/aside-seydel.jpg" alt="Seydel" class="sidebar-img"></a>
<a href="http://www.seydel1847.de/"><img src="<?=get_template_directory_uri();?>/img/aside-1847.jpg" alt="1847" class="sidebar-img"></a>
<div class="sidebar-widget">
<?php if(!function_exists('dynamic_sidebar') || !dynamic_sidebar('sidebar-2')) ?>
</div>
示例10: takeaway_show_mini_cart
function takeaway_show_mini_cart()
{
return woocommerce_mini_cart();
wp_die();
}
示例11: wpo_cartdropdown
function wpo_cartdropdown()
{
if (WPO_WOOCOMMERCE_ACTIVED) {
global $woocommerce;
?>
<div id="cart" class="dropdown">
<span class="text-skin cart-icon">
<i class="icon-cart2"></i>
</span>
<a class="dropdown-toggle mini-cart" data-toggle="dropdown" aria-expanded="true" role="button" aria-haspopup="true" data-delay="0" href="#" title="<?php
_e('View your shopping cart', 'woothemes');
?>
">
<span class="title-cart"><?php
_e('My Cart ', TEXTDOMAIN);
?>
</span>
<?php
echo sprintf(_n(' <span class="mini-cart-items"> %d item </span> ', ' <span class="mini-cart-items"> %d items - </span> ', $woocommerce->cart->cart_contents_count, 'woothemes'), $woocommerce->cart->cart_contents_count);
?>
<?php
echo trim($woocommerce->cart->get_cart_total());
?>
</a>
<div class="dropdown-menu">
<?php
woocommerce_mini_cart();
?>
</div>
</div>
<?php
}
}
示例12: flatsome_add_to_cart_dropdown
function flatsome_add_to_cart_dropdown($fragments)
{
global $woocommerce;
global $flatsome_opt;
ob_start();
?>
<div class="cart-inner">
<a href="<?php
echo esc_url($woocommerce->cart->get_cart_url());
?>
" class="cart-link">
<strong class="cart-name hide-for-small"><?php
_e('Cart', 'woocommerce');
?>
</strong>
<span class="cart-price hide-for-small">/ <?php
echo $woocommerce->cart->get_cart_subtotal();
?>
</span>
<!-- cart icon -->
<div class="cart-icon">
<?php
if ($flatsome_opt['custom_cart_icon']) {
?>
<div class="custom-cart-inner">
<div class="custom-cart-count"><?php
echo $woocommerce->cart->cart_contents_count;
?>
</div>
<img class="custom-cart-icon" alt="<?php
_e('Cart', 'woocommerce');
?>
" src="<?php
echo $flatsome_opt['custom_cart_icon'];
?>
"/>
</div><!-- .custom-cart-inner -->
<?php
} else {
?>
<strong><?php
echo $woocommerce->cart->cart_contents_count;
?>
</strong>
<span class="cart-icon-handle"></span>
<?php
}
?>
</div><!-- end cart icon -->
</a>
<div class="nav-dropdown">
<div id="mini-cart-content" class="nav-dropdown-inner widget_shopping_cart widget_shopping_cart_content">
<?php
if (sizeof($woocommerce->cart->cart_contents) > 0) {
echo woocommerce_mini_cart();
} else {
echo '<p class="empty">' . __('No products in the cart.', 'woocommerce') . '</p>';
}
?>
</div><!-- .nav-dropdown-inner -->
</div><!-- .nav-dropdown -->
</div><!-- .cart-inner -->
<?php
$fragments['.cart-inner'] = ob_get_clean();
return $fragments;
}
示例13: minicart_remove_item
public function minicart_remove_item()
{
global $woocommerce;
$response = array();
if (!isset($_GET['item']) && !isset($_GET['_wpnonce'])) {
exit;
}
$woocommerce->cart->set_quantity($_GET['item'], 0);
$cart_total = $woocommerce->cart->get_cart_total();
$cart_count = absint($woocommerce->cart->cart_contents_count);
$response['minicart_text'] = $cart_count;
$response['minicart'] = $this->_get_minicart(true);
// widget cart update
ob_start();
woocommerce_mini_cart();
$mini_cart = ob_get_clean();
$response['widget'] = '<div class="widget_shopping_cart_content">' . $mini_cart . '</div>';
echo json_encode($response);
exit;
}
示例14: wpo_cartdropdown
function wpo_cartdropdown()
{
if (class_exists('WooCommerce')) {
global $woocommerce;
?>
<div class="dropdown cart-header">
<h4>购物车</h4>
<a class="dropdown-toggle cart-dropdown" data-toggle="dropdown" data-hover="dropdown" data-delay="0" href="#" title="<?php
_e('View your shopping cart', 'woothemes');
?>
">
<?php
echo sprintf(_n('%d item', '%d items', $woocommerce->cart->cart_contents_count, 'woothemes'), $woocommerce->cart->cart_contents_count);
?>
- <?php
echo $woocommerce->cart->get_cart_total();
?>
</a>
<div class="dropdown-menu">
<?php
woocommerce_mini_cart();
?>
</div>
</div>
<?php
}
}
示例15: wpo_cartdropdown
function wpo_cartdropdown()
{
global $woocommerce;
?>
<div class="dropdown">
<!-- <h4>Shopping Cart</h4> -->
<a class="dropdown-toggle mini-cart" data-toggle="dropdown" data-hover="dropdown" data-delay="0" href="#" title="<?php
_e('View your shopping cart', 'woothemes');
?>
">
<i class="fa fa-shopping-cart"></i>
<?php
echo sprintf(_n('%d item', '%d items', $woocommerce->cart->cart_contents_count, 'woothemes'), $woocommerce->cart->cart_contents_count);
?>
- <?php
echo $woocommerce->cart->get_cart_total();
?>
</a>
<div class="dropdown-menu">
<?php
woocommerce_mini_cart();
?>
</div>
</div>
<?php
}