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

本文标签: