0

I'm triing to print some values stored in a post meta.

My post meta_values looks like this :

a:3:{s:6:"amount";s:117:"€2.00";s:6:"entity";s:5:"11854";s:9:"reference";s:9:"800146779";}

I'm using the function bellow in order to try to print the Amount, the Entity and the Reference but all I'm getting is the first character of the Value.

Here's my function:

 
    function get_value( $order, $parameters ) {
        $order_id = Compat\Order::get_id( $order );
        global $wpdb;

        $ref_multibanco = get_post_meta($order_id,'_stripe_multibanco', true); // select array

        return $ref_multibanco['amount']['entity']['reference'];
    }

And since i'm asking I would like to print this like:

Ent: 11854
Ref: 800146779
Value: €2.00
1
function get_value( $order, $parameters ) {
    $order_id = Compat\Order::get_id( $order );
    global $wpdb;

    $ref_multibanco = get_post_meta($order_id,'_stripe_multibanco', true); // select array

    $text_print = 'Ent: '.$ref_multibanco["entity"].'<br>Ref: '.$ref_multibanco["reference"].'<br>Value: '.$ref_multibanco["amount"];

    return $text_print;
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.