本文整理汇总了PHP中woocommerce_mini_cart函数的典型用法代码示例。如果您正苦于以下问题:PHP woocommerce_mini_cart函数的具体用法?PHP woocommerce_mini_cart怎么用?PHP woocommerce_mini_cart使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了woocommerce_mini_cart函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
}
}
开发者ID:shubham79,项目名称:Jhintaak,代码行数:32,代码来源:theme.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);
}
开发者ID:uwitec,项目名称:findgreatmaster,代码行数:13,代码来源:class-wc-ajax.php
示例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;
}
开发者ID:pcuervo,项目名称:od4d,代码行数:10,代码来源:custom-header.php
示例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;
}
开发者ID:rongandat,项目名称:sallumeh,代码行数:19,代码来源:woocommerce-ajax.php
示例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;
}
开发者ID:Qualitair,项目名称:ecommerce,代码行数:53,代码来源:mini-cart.php
示例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
}
开发者ID:purgesoftwares,项目名称:purges,代码行数:18,代码来源:wc-functions.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>";
}
开发者ID:alfredpp,项目名称:sarath-portfolio,代码行数:16,代码来源:theme-woocommerce.php
示例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
}
开发者ID:baridavid,项目名称:themes,代码行数:49,代码来源:woo.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>
开发者ID:Raxszeon,项目名称:FatHarp,代码行数:30,代码来源:sidebar.php
示例10: takeaway_show_mini_cart
function takeaway_show_mini_cart()
{
return woocommerce_mini_cart();
wp_die();
}
开发者ID:ankitparsanaa,项目名称:foodapp,代码行数:5,代码来源:functions.php
示例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
}
}
开发者ID:WestBayResidential,项目名称:wbrsorg,代码行数:33,代码来源:woocommerce.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;
}
开发者ID:brfigueiredo,项目名称:htdocs,代码行数:73,代码来源:template-tags-global.php
示例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;
}
开发者ID:jonasbelcina,项目名称:platinumdxb,代码行数:20,代码来源:woocommerce.php
示例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
}
}
开发者ID:k2jysy,项目名称:mergeshop,代码行数:27,代码来源:functions.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
}
开发者ID:shubham79,项目名称:Jhintaak,代码行数:26,代码来源:woocommerce.php
示例16: widget
function widget($args, $instance)
{
$instance = wp_parse_args($instance, $this->default_values);
if (empty($instance['show_on_checkout']) && (is_cart() || is_checkout())) {
return;
}
$woocommerce = WC();
$before_widget = $after_widget = $before_title = $after_title = '';
extract($args, EXTR_OVERWRITE);
$hide_if_empty = empty($instance['hide_if_empty']) ? 0 : 1;
$popup_align = $instance['popup_align'] == 'left' ? 'left' : 'right';
echo $before_widget;
$title = apply_filters('widget_title', $instance['title']);
if ($title) {
echo $before_title . $title . $after_title;
}
$cart_contents_count = $woocommerce->cart->get_cart_contents_count();
?>
<div class="widget_shopping_mini_cart_content" id="<?php
echo $this->id;
?>
-content">
<?php
if (!$hide_if_empty || $cart_contents_count > 0) {
?>
<div class="dropdown-cart-button <?php
echo $hide_if_empty ? 'hide_dropdown_cart_widget_if_empty' : '';
?>
" style="<?php
echo $hide_if_empty && sizeof($woocommerce->cart->get_cart()) == 0 ? "display:none;" : "";
?>
">
<a href="#" class="dropdown-total"><?php
echo $cart_contents_count . '' . _n(__('x', 'woocommerce-ddc'), __('x', 'woocommerce-dc'), $cart_contents_count);
?>
- <?php
echo $woocommerce->cart->get_cart_subtotal();
?>
</a>
<div class="dropdown dropdown-<?php
echo $popup_align;
?>
">
<?php
woocommerce_mini_cart();
?>
<div class="clear"></div>
</div>
</div>
<?php
} else {
?>
<script type="text/javascript">
jQuery(function($){
$('#<?php
echo $this->id;
?>
').hide();
});
</script>
<?php
}
?>
</div>
<?php
echo $after_widget;
}
开发者ID:daanbakker1995,项目名称:vanteun,代码行数:67,代码来源:woocommerce-dropdown-cart.php
示例17: tt_bar_content
/**
* Prints Top Bar content
* @param type $type : Menu type
* @param type $position : Right or Left
*/
function tt_bar_content($bar_content = 'text1', $footer = false)
{
global $smof_data;
$splitedValues = explode(',', trim($bar_content));
foreach ($splitedValues as $value) {
$type = trim($value);
$pref = 'top_';
if ($footer) {
$pref = 'footer_';
}
if ($type == 'social') {
ob_start();
social_links_by_icon($footer);
$result = ob_get_clean();
echo '<div class="topbar-item">' . $result . '</div>';
} elseif ($type == 'shop') {
global $woocommerce;
if (isset($woocommerce->cart)) {
$cart = $woocommerce->cart;
// Get mini cart
ob_start();
woocommerce_mini_cart();
$mini_cart = ob_get_clean();
echo '<div class="woocommerce-shcart woocommerce topbar-item hidden-sm hidden-xs">
<div class="shcart-display">
<i class="fa fa-shopping-cart"></i>' . __('Cart', 'themeton') . '
<span class="total-cart">' . $cart->cart_contents_count . '</span>
</div>
<div class="shcart-content">
<div class="widget_shopping_cart_content">' . $mini_cart . '</div>
</div>
</div>';
} else {
echo '<div class="topbar-item">' . __('Please install Woocommerce.', 'themeton') . '</div>';
}
} elseif ($type == 'lang') {
global $wp_filter;
if (isset($wp_filter['icl_language_selector'])) {
ob_start();
do_action('icl_language_selector');
$result = ob_get_clean();
echo '<div class="topbar-item">' . $result . '</div>';
} else {
echo '<div class="topbar-item">' . __('Please install WPML.', 'themeton') . '</div>';
}
} elseif ($type == 'menu') {
ob_start();
wp_nav_menu(array('theme_location' => $pref . 'bar-menu', 'fallback_cb' => '', 'depth' => 1, 'menu_class' => 'list-inline'));
$result = ob_get_clean();
echo '<div class="topbar-item">' . $result . '</div>';
} elseif ($type == 'text1' || $type == 'text2') {
if (isset($smof_data[$pref . 'bar_' . $type])) {
$result = '<span class="bar-text">' . do_shortcode($smof_data[$pref . 'bar_' . $type]) . '</span>';
echo '<div class="topbar-item">' . $result . '</div>';
}
} else {
if ($type == 'login') {
$link = get_edit_user_link();
$text = __('Login / Register', 'themeton');
if (function_exists('is_shop')) {
$link = get_permalink(get_option('woocommerce_myaccount_page_id'));
} else {
if (!is_user_logged_in()) {
$link = wp_login_url();
}
}
if (is_user_logged_in()) {
$text = __('My Account', 'themeton');
}
$result = '<div class="topbar-item login-item">
<a href="' . $link . '">' . $text . '</a>
</div>';
echo $result;
}
}
}
}
开发者ID:petersondrs,项目名称:tellura,代码行数:82,代码来源:common-functions.php
示例18: ajax_get_mini_cart
function ajax_get_mini_cart()
{
woocommerce_mini_cart();
exit;
}
开发者ID:atmawarin,项目名称:style-guide,代码行数:5,代码来源:functions-store.php
示例19: _e
?>
<ul class="topmenu">
<li><a href="#login" class="smallimg vbplogin"><span><?php
_e('LOGIN', 'vibe');
?>
</span></a></li>
<?php
if (in_array('woocommerce/woocommerce.php', apply_filters('active_plugins', get_option('active_plugins'))) || function_exists('is_plugin_active_for_network') && is_plugin_active_for_network('woocommerce/woocommerce.php')) {
global $woocommerce;
?>
<li><a class="smallimg vbpcart"><span class="fa fa-shopping-cart"><?php
echo $woocommerce->cart->cart_contents_count ? '<em>' . $woocommerce->cart->cart_contents_count . '</em>' : '';
?>
</span></a>
<div class="woocart"><?php
woocommerce_mini_cart();
?>
</div>
</li>
<?php
}
?>
</ul>
<?php
}
?>
<?php
$style = vibe_get_login_style();
if (empty($style)) {
$style = 'default_login';
}
开发者ID:nikitansk,项目名称:devschool,代码行数:31,代码来源:header-transparent.php
示例20: kleo_woo_remove_item
function kleo_woo_remove_item()
{
global $woocommerce;
$response = array();
if (!isset($_GET['kleo_item']) && !isset($_GET['_wpnonce'])) {
exit;
}
WC()->cart->set_quantity($_GET['kleo_item'], 0);
$cart_count = $woocommerce->cart->cart_contents_count;
$response['count'] = $cart_count != 0 ? $cart_count : "";
$response['cart'] = kleo_woo_get_mini_cart(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;
}
开发者ID:quyip8818,项目名称:wps,代码行数:19,代码来源:config.php
注:本文中的woocommerce_mini_cart函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论