• Hi, I’m trying the plugin but I’m stuck with a problem on emails in “plain text”.

    The first anomaly was having all the fields close together
    Ex:

    Choose the bases: White rice Choose the bases: Venus rice Choose the
    proteins: Grilled octopus. Choose extra proteins: Cooked shrimp (+
    2.00 EUR) Choose vegetables: Ginger in Brine Choose vegetables
    vegetables: Mango (+ 1.00 EUR) See composition

    Using a custom code I managed to send them to the head.
    Here if it can be of use to someone:

    foreach ($items as $item_id => $item):
    if (apply_filters("woocommerce_order_item_visible", true, $item)) {
    $product = $item->get_product();
    $sku = "";
    $purchase_note = "";

    if (is_object($product)) {
    $sku = $product->get_sku();
    $purchase_note = $product->get_purchase_note();
    }

    echo apply_filters(
    "woocommerce_order_item_name",
    $item->get_name(),
    $item,
    false
    );
    if ($show_sku && $sku) {
    echo " (#" . $sku . ")";
    }
    echo " X " .
    apply_filters(
    "woocommerce_email_order_item_quantity",
    $item->get_quantity(),
    $item
    );
    echo " = " . $order->get_formatted_line_subtotal($item);

    // allow other plugins to add additional product information here
    do_action(
    "woocommerce_order_item_meta_start",
    $item_id,
    $item,
    $order,
    $plain_text
    );

    // Retrieve and process item meta data
    $item_meta_data = $item->get_formatted_meta_data("_", true);
    foreach ($item_meta_data as $meta) {
    $cleaned_value = strip_tags($meta->display_value); // Remove HTML tags
    $cleaned_value = str_replace("wcpa_empty_label:", "", $cleaned_value); // Remove empty labels
    $cleaned_value = str_replace("|", "\n", $cleaned_value); // Replace '|' with newlines
    $lines = explode("\n", $cleaned_value);
    foreach ($lines as $line) {
    $line = trim($line);
    if (!empty($line)) {
    echo "\n" . $line; // Ensure each line goes to a new row
    }
    }
    }

    // allow other plugins to add additional product information here
    do_action(
    "woocommerce_order_item_meta_end",
    $item_id,
    $item,
    $order,
    $plain_text
    );
    }

    // Note
    if ($show_purchase_note && $purchase_note) {
    echo "\n" . do_shortcode(wp_kses_post($purchase_note));
    }
    echo "\n\n";
    endforeach;

    Now I can’t do 2 things:

    • remove the layer label
    • remove “See composition”

    Can someone help me figure out how to do it?

  • You must be logged in to reply to this topic.