【问题标题】:Show price instead of quantity in shopping cart wordpress [closed]在购物车 wordpress 中显示价格而不是数量 [关闭]
【发布时间】:2023-03-24 15:20:01
【问题描述】:

在这个网站上:https://www.stenenentegels.nl/

购物车在网站的右上角。 当它未折叠打开时,它会在橙色圆圈中显示购物车的数量。 我想在那里显示价格而不是数量。有人对此有解决方案吗?

我用这个插件来定制购物车:https://wordpress.org/plugins/woo-floating-cart-lite/

我认为最好的方法是在functions.php文件中写一个函数。

希望大家能帮帮我!

【问题讨论】:

标签: php wordpress woocommerce shopping-cart


【解决方案1】:

我检查了这个
所以你必须改变的是:

复制这个文件:

.../plugins/woo-floating-cart-lite/public/templates/parts/trigger.php

到(在此文件的标题中进行了描述)

.../themes/yourtheme/woo-floating-cart/parts/trigger.php

在您复制的文件中,将第 26 到 40 行替换为:

$total_items = WC()->cart->get_cart_contents_count();
$icon_type = woofc_option('trigger_icon_type', 'image');

// Get Cart total price including tax
$ordertotal = wp_kses_data( WC()->cart->get_total() );
?>

<a href="#" class="woofc-trigger<?php echo (($total_items > 99) ? ' woofc-count-big' : '');?> woofc-icontype-<?php echo $icon_type;?>">

    <span class="<?php echo woofc_trigger_cart_icon_class();?>"></span>

    <ul class="woofc-count"> <!-- cart items count -->
        <li><?php echo ($ordertotal);?></li>
        <li><?php echo ($total_items + 1);?></li>
    </ul> <!-- .count -->

    <span class="<?php echo woofc_trigger_close_icon_class();?>"></span>
</a>

当然,你应该这样做是一个儿童主题!

【讨论】:

  • 感谢您这么快回复!下周我可以测试它而不是你听到我的消息;)
  • 我按你说的更新了,但它仍然显示数量而不是价格
猜你喜欢
  • 1970-01-01
  • 2013-01-02
  • 2017-02-08
  • 2020-03-11
  • 2018-06-20
  • 1970-01-01
  • 1970-01-01
  • 2017-05-02
  • 1970-01-01
相关资源
最近更新 更多