Viewing 1 replies (of 1 total)
  • Plugin Author Webikon s.r.o.

    (@webikon)

    Dobrý deň,
    do emailu je možné vložiť číslo balíka. To číslo sa po exporte objednávky do DPD uloží do meta poľa dpd_export_package_number. Vy ho potom môžete odtiaľ vytiahnuť a vložiť do emailu napr. pomocou WC hooku woocommerce_email_after_order_table. Kód by mohol vyzerať nejako takto, no je možné, že si to ešte budete musieť prispôsobiť.

    add_action('woocommerce_email_after_order_table', function ($order, $sent_to_admin, $plain_text, $email) {
    // Only show to customers, not admin
    if ($sent_to_admin) {
    return;
    }

    // Get package number
    $package_number = $order->get_meta('dpd_export_package_number', true);

    if (empty($package_number)) {
    return;
    }

    // Only show in specific email types
    $email_types = ['customer_completed_order', 'customer_processing_order', 'customer_on_hold_order', 'customer_invoice'];
    if (!in_array($email->id, $email_types)) {
    return;
    }

    echo "<p>DPD číslo balíka: " . $package_number . "</p>";
    }, 15, 4);
Viewing 1 replies (of 1 total)

The topic ‘Tracking kód’ is closed to new replies.