I’m building a shortcode for woocommerce, I was wondering how I can add some text just before the $order_id variable.
Current code
<div class="items_orders_card"> <span class="items_title">Order</span> '. $order_id .' </div>
Current output is Order: 39800
Output I want to get Order: #39800
I would like to add the pound sign (#) just before the number. Is there a specific way to do this? Also, does the same rule apply to text ?
>Solution :
I guess you can use
<div class="items_orders_card"> <span class="items_title">Order</span> #'. $order_id .' </div>
or
<div class="items_orders_card"> <span class="items_title">Order</span> '. sprintf("#%d", $order_id) .' </div>