• Resolved b3rgaxx

    (@b3rgaxx)


    Hello, I’ve to create a function where I’ve to input a custom field with the name (NumDdt and DateDdt), but this function doesn’t work:
    function modifica_fattura_elettronica($result_array, $order ) {
    $importo = (float)$order->get_total();
    $data = $order->get_date_created();
    $NumDdt = $order->custom_field(‘NumDdt’);
    $DateDdt = $order->custom_field(‘DateDdt’);

    $doc = new DOMDocument();
    $doc->preserveWhiteSpace = false;
    $doc->formatOutput = true;
    $doc->loadXML($result_array[“xml”]);
    $FatturaElettronicaBody = $doc->getElementsByTagName(“FatturaElettronicaBody”)->item(0);

    $DatiDDT = $doc->createElement(“DatiDDT”);
    $DatiTrasporto = $doc->createElement($NumDdt); //TP02 = pagamento completo
    $DatiDDT->appendChild($DatiTrasporto);

    $FatturaElettronicaBody->appendChild($DatiDDT);

    $xml = $doc->saveXML();
    $result_array[“xml”] = $xml;
    return $result_array;
    }
    add_action( ‘wcpdf_IT_after_creaFatturaElettronica’, ‘modifica_fattura_elettronica’, 20, 2 );

    Anyone can help me? thank you

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Can You find the syntax error?’ is closed to new replies.