• Resolved jaynchou

    (@jaynchou)


    I have a 3rd party tracking number pugin, and I create a shortcode based on that, but when I enter the shortcode in your emial template, it’s not working at all.

Viewing 12 replies - 1 through 12 (of 12 total)
  • Thread Starter jaynchou

    (@jaynchou)

    just to be more clearly, this is the meta key is use to create the shortcode: meta key _dianxiaomi_tracking_number

    Plugin Support villasupport

    (@villasupport)

    Hi,

    Thank you for contacting VillaTheme.

    We have a shortcode to display the order meta in our email template, if this meta key is WooCommerce order meta, it should display.

    The shortcode is a premium feature only:

    [wec_order_meta_subject key=""]
    [wec_order_meta key=""]

    Best regards.

    Thread Starter jaynchou

    (@jaynchou)

    how to buy your premium??

    Plugin Support villasupport

    (@villasupport)

    Thread Starter jaynchou

    (@jaynchou)

    So I just download the premium?package and overwrite my old one? will my data keep the same? I mean my current email template will gone? Or keep the same?

    Plugin Support villasupport

    (@villasupport)

    Hi, All data and settings of the plugin will remain the same after overriding the pro version.

    Thread Starter jaynchou

    (@jaynchou)

    Should I create shortcode first? Or I just directly use the meta key from my 3rd party plugin?

    I will show you the code: Below is where my tracking number stored:

    function save_meta_box($post_id, $post)
    {
        if (isset($_POST['dianxiaomi_tracking_number'])) {
    
            // Download data
            $tracking_provider = woocommerce_clean($_POST['dianxiaomi_tracking_provider']);
    
            update_post_meta($post_id, '_dianxiaomi_tracking_provider', $tracking_provider);
    
            foreach ($this->dianxiaomi_fields as $field) {
                if ($field['type'] == 'date') {
                    update_post_meta($post_id, '_' . $field['id'], woocommerce_clean(strtotime($_POST[$field['id']])));
                } else {
                    update_post_meta($post_id, '_' . $field['id'], woocommerce_clean($_POST[$field['id']]));
                }
            }
        }
    }

    And my question is, should I create a shortcode first based on the meta key(_danxiaomi_tracking_number) like below?

    add_filter( 'woocommerce_email_order_meta_fields', 'add_tracking_number_to_order_meta_fields', 10, 3 );
    function add_tracking_number_to_order_meta_fields( $fields, $sent_to_admin, $order ) {
        $tracking_number = get_post_meta( $order->get_id(), '_dianxiaomi_tracking_number', true ); // replace '_dianxiaomi_tracking_number' with the actual meta key used to store the tracking number
        if ( $tracking_number ) {
            $fields['{dianxiaomi_tracking_number}'] = array(
                'label' => 'Tracking Number',
                'value' => $tracking_number,
            );
        }
        return $fields;

    I’ve tried both [wec_order_meta key=”_dianxiaomi_tracking_number”] and [wec_order_meta key=”dianxiaomi_tracking_number”], nothing happened. There is no output in my email.

    Or should I copy this meta key to order meta? not post meta?

    Plugin Support villasupport

    (@villasupport)

    Hi,

    Please contact us on our support forum, our developer will assist you with this issue.

    Best regards.

    Thread Starter jaynchou

    (@jaynchou)

    I contact them, do you have a live support? Only email?

    Plugin Support villasupport

    (@villasupport)

    Hi,

    We received your ticket on our support forum and the problem was handled: https://villatheme.com/supports/topic/tracking-number-shortcode-isnt-workinng/

    Best regards.

    Plugin Support villasupport

    (@villasupport)

    Hi,

    The problem of this ticket was resolved.

    In your case, it has a different method to handle. Please use the WC hook feature to display the email content of the shipment tracking plugin. You can refer to this guide: https://youtu.be/XDRhSJzFFbM and check with our free version.

    Best regards.

    • This reply was modified 1 year, 6 months ago by villasupport.
    Plugin Support villasupport

    (@villasupport)

    Based on the information you provided, our plugin – The premium version supports shortcodes to display the meta of the order ( https://ibb.co/hBynf2c ). However, it will be visible under the array data, not the table style as it is in WooCommerce. You can write shortcodes to display.

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Tracking number Shortcode isn’t wroking!!!’ is closed to new replies.