0

我已经从http://demo.woothemes.com/boutique/product/woo-ninja-3/复制了代码

<ul id="site-header-cart" class="site-header-cart menu">
            <li class="">
                                                    <a class="cart-contents" href="http://demo.woothemes.com/boutique/cart/" title="View your shopping cart">
                <span class="amount">£168.00</span> <span class="count">12 items</span>
            </a>


                    </li>
            <li>
                <div class="widget woocommerce widget_shopping_cart" style="opacity: 1;"><div class="widget_shopping_cart_content">

<ul class="cart_list product_list_widget ">


                            <li class="mini_cart_item">
                        <a href="http://demo.woothemes.com/boutique/cart/?remove_item=fbd7939d674997cdb4692d34de8633c4&amp;_wpnonce=ab5f6b26c4" class="remove" title="Remove this item" data-product_id="76" data-product_sku="">×</a>                                                  <a href="http://demo.woothemes.com/boutique/product/woo-ninja-3/">
                                <img width="150" height="150" src="//demo.woothemes.com/boutique/wp-content/uploads/sites/79/2013/06/6771456709_fc540cc175_b.jpg?w=150&amp;h=150&amp;crop=1" class="attachment-shop_thumbnail size-shop_thumbnail wp-post-image" alt="" srcset="//demo.woothemes.com/boutique/wp-content/uploads/sites/79/2013/06/6771456709_fc540cc175_b-150x150.jpg 150w, //demo.woothemes.com/boutique/wp-content/uploads/sites/79/2013/06/6771456709_fc540cc175_b-500x500.jpg 500w, //demo.woothemes.com/boutique/wp-content/uploads/sites/79/2013/06/6771456709_fc540cc175_b-800x800.jpg 800w" sizes="(max-width: 150px) 100vw, 150px">Woo Ninja&nbsp;                         </a>

                        <span class="quantity">6 × <span class="woocommerce-Price-amount amount"><span class="woocommerce-Price-currencySymbol">£</span>15.00</span></span>                 </li>
                                        <li class="mini_cart_item">
                        <a href="http://demo.woothemes.com/boutique/cart/?remove_item=7cbbc409ec990f19c78c75bd1e06f215&amp;_wpnonce=ab5f6b26c4" class="remove" title="Remove this item" data-product_id="70" data-product_sku="">×</a>                                                  <a href="http://demo.woothemes.com/boutique/product/flying-ninja/">
                                <img width="150" height="150" src="//demo.woothemes.com/boutique/wp-content/uploads/sites/79/2013/06/6771457369_92e02576a8_o.jpg?w=150&amp;h=150&amp;crop=1" class="attachment-shop_thumbnail size-shop_thumbnail wp-post-image" alt="" srcset="//demo.woothemes.com/boutique/wp-content/uploads/sites/79/2013/06/6771457369_92e02576a8_o-150x150.jpg 150w, //demo.woothemes.com/boutique/wp-content/uploads/sites/79/2013/06/6771457369_92e02576a8_o-500x500.jpg 500w" sizes="(max-width: 150px) 100vw, 150px">Flying Ninja&nbsp;                          </a>

                        <span class="quantity">4 × <span class="woocommerce-Price-amount amount"><span class="woocommerce-Price-currencySymbol">£</span>12.00</span></span>                 </li>
                                        <li class="mini_cart_item">
                        <a href="http://demo.woothemes.com/boutique/cart/?remove_item=735b90b4568125ed6c3f678819b6e058&amp;_wpnonce=ab5f6b26c4" class="remove" title="Remove this item" data-product_id="67" data-product_sku="">×</a>                                                  <a href="http://demo.woothemes.com/boutique/product/ship-your-idea-3/">
                                <img width="150" height="150" src="//demo.woothemes.com/boutique/wp-content/uploads/sites/79/2013/06/6771457549_3838523969_b.jpg?w=150&amp;h=150&amp;crop=1" class="attachment-shop_thumbnail size-shop_thumbnail wp-post-image" alt="" srcset="//demo.woothemes.com/boutique/wp-content/uploads/sites/79/2013/06/6771457549_3838523969_b-150x150.jpg 150w, //demo.woothemes.com/boutique/wp-content/uploads/sites/79/2013/06/6771457549_3838523969_b-500x500.jpg 500w" sizes="(max-width: 150px) 100vw, 150px">Ship Your Idea Silver Plated Ring&nbsp;                         </a>

                        <span class="quantity">2 × <span class="woocommerce-Price-amount amount"><span class="woocommerce-Price-currencySymbol">£</span>15.00</span></span>                 </li>


</ul><!-- end product list -->


    <p class="total"><strong>Subtotal:</strong> <span class="woocommerce-Price-amount amount"><span class="woocommerce-Price-currencySymbol">£</span>168.00</span></p>


    <p class="buttons">
        <a href="http://demo.woothemes.com/boutique/cart/" class="button wc-forward">View Cart</a>
        <a href="http://demo.woothemes.com/boutique/checkout/" class="button checkout wc-forward">Checkout</a>
    </p>


</div></div>            </li>
        </ul>

进入我自己的模板;但是,当小部件出于某种原因更新数据时,“购物车内容”区域(如下所示)不会更新数量和项目计数。

<li class="">
    <a class="cart-contents" href="http://demo.woothemes.com/boutique/cart/" title="View your shopping cart">
        <span class="amount">£168.00</span> <span class="count">12 items</span>
    </a>
</li>

如何解决我的问题?我假设缺少一些js?

4

1 回答 1

0

WooCommerce 要求您将购物车区域添加到其方法中。

有关它的更多信息,请参见: https ://docs.woocommerce.com/document/show-cart-contents-total/

于 2017-06-08T14:09:14.000 回答