admin管理员组文章数量:1279085
I am trying to get current cart items from my own plugin using WC_Shortcodes::cart(); this will return cart details in html format.
WC()->cart->get_cart();
code not working. i need only cart data without html format. please advise thank you.
I am trying to get current cart items from my own plugin using WC_Shortcodes::cart(); this will return cart details in html format.
WC()->cart->get_cart();
code not working. i need only cart data without html format. please advise thank you.
Share Improve this question asked Nov 4, 2021 at 6:25 HajaHaja 34 bronze badges1 Answer
Reset to default 0You can get the value by using the global var
global $woocommerce;
$cart_value = floatval( preg_replace( '#[^\d.]#', '', $woocommerce->cart->get_cart_total() ) );
Or
WC()->cart->total
本文标签: pluginsHow to get current cart values using WCShortcodes
版权声明:本文标题:plugins - How to get current cart values using WC_Shortcodes? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741235443a2362922.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论