• Resolved choutin

    (@choutin)


    I use the following code to add a hook to the pdf file. with the version 1.3.1. It worked good. but after update your plugin to the latest version, the time doesn’t display correct. just some numbers. I know you have change the time display after 1.31 because some bug in display time in 1.3.1. so I update the latest version 1.3.12 but the time display not working now. Please help. Thank you.

    //add pickup time to the pdf file in local pickup time select 1.3.1 version
    add_action( ‘wpo_wcpdf_after_order_data’, ‘wpo_wcpdf_pickup_time’, 10, 2 );
    function wpo_wcpdf_pickup_time ($template_type, $order) {
    $order_meta = get_post_custom( $order->id );
    $value = $order_meta[‘_local_pickup_time_select’][0];
    $value = preg_replace(‘/(\d)_(\d)/’,’$1:$2′, $value);
    $value = explode(‘_’, $value);
    $time = __( $value[0], ‘woocommerce-local-pickup-time’ ). ‘ ‘ .$value[1];
    echo ‘<p>‘ . __( ‘Time Choose: ‘, ‘woocommerce-local-pickup-time’ ) . ‘ ‘ . $time . ‘</p>’;
    }

    • This topic was modified 4 years, 5 months ago by choutin.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Tim Nolte

    (@tnolte)

    @choutin so the value stored was changed some time ago to use a Unix timestamp. You should be able to use something like this:

    $local_pickup_time_select = Local_Pickup_Time::get_instance();
    $value = $local_pickup_time_select->pickup_time_select_translatable( $order_meta[‘_local_pickup_time_select’][0] );

    That should get you what you need for output.

    • This reply was modified 4 years, 5 months ago by Tim Nolte.
    Thread Starter choutin

    (@choutin)

    I have try the code but doesn’t work. Can you help write the whole code? Thank you.

    Plugin Author Tim Nolte

    (@tnolte)

    What error did you get? You can try this variation:
    The following code should work:

    $pickup_time_select = Local_Pickup_Time::get_instance();
    $pickup_time = get_post_meta( $order->id, '_local_pickup_time_select', true );
    $pickup_time_select->pickup_time_select_translatable( $pickup_time );
    Thread Starter choutin

    (@choutin)

    Thank you. Using the first code works now. Something was wrong, maybe the ” copy directly not working.

    Plugin Author Tim Nolte

    (@tnolte)

    Glad to hear it.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘hook to pdf file. error after update to latest version’ is closed to new replies.