admin管理员组文章数量:1323348
More detailed: I'd like to use the the number of items which were bought by somebody and multiplicate it with a number, to show how much water somebody saved.
function random_message(){
$count = 0;
foreach ( $order->get_items() as $items ) {
// Count + 1
$count++;
}
$mes = array('Message 12', 'Message 13', 'Message 14');
$multiplier = 7950;
shuffle($mes);
echo 'you saved ' . $count * $multiplier . 'l water';
//echo 'With this order ' . $mes[0];
}
add_shortcode( 'random_message', 'random_message' );
I wrote this code to my functions.php inside of my child-theme. At the moment I get an error: Screenshot
本文标签:
版权声明:本文标题:php - How can I show how much water got saved on this order (making use of the number of items bought) on a thank-you-page? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742132122a2422208.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论