最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

customization - Viewing checkout page removes fees from mini cart

programmeradmin1浏览0评论

I customized the mini cart to show a breakdown of fees (discounts) to the customer. This works however if you visit the checkout page, which also uses ajax to load cart totals, when its done loading, it removes the fees from my mini cart. I am using $woocommerce->cart->get_fees() to get fees in the mini cart. On the checkout page that value comes back empty. Why is this? What can I do to make it always load my fees?

----------------DETAILS---------------------

Mini-cart.php is the file I added the discounts to. The original file from Woocommerce uses things like:

WC()->cart->get_product_price( $_product )

I am using WC()->cart to display extra information as well. And getting the discount total does work by using:

WC()->cart->get_fee_total()

I am also trying to get the details of fees.. As in you can have a multi buy discount for $5 and a membership discount of $3. I'd like to show the name of the discount and the amount.

These are the functions I've tried that haven't worked:

WC()->cart->get_fees()
WC()->cart->fees_api()

These two work initially.. but when you visit the checkout page.. the checkout page empties this area. It seems that to get the fee line item detail, Woocommerce needs to access a fees_api or class.. and for some reason the checkout page doesn't allow this access?? However on the homepage, product page, any other page.. you can access the fees api or class.

发布评论

评论列表(0)

  1. 暂无评论