Status Change jobs
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | // PDF format , just like invoice // output order detailsa bove  item list add_action("woe_pdf_started", function ($pdf, $formatter) {     $reflection = new ReflectionClass($formatter);     $property   = $reflection->getProperty('storage');     $property->setAccessible(true);     $storage = $property->getValue($formatter);     $addText = function ($hookRow) use ($pdf, &$addText, $storage) {         $storage->loadFull();         $rowObj = $storage->getRow(0);         if ( ! $rowObj) {             return $hookRow;         }         $offset   = 0;         $row    = $rowObj->getData();         $order = new WC_Order( $rowObj->getMetaItem( "order_id" ));         $billing = WC()->countries->get_formatted_address($order->get_address('billing'), PHP_EOL);         $shipping = WC()->countries->get_formatted_address($order->get_address('shipping'), PHP_EOL);         $x = $pdf->GetX();         $y = $pdf->GetY();         $rowHeight = 5;         $xOffset = 120;         $pdf->SetFont('', 'B');         $pdf->Cell(20, $rowHeight, "Billing address:");         $pdf->SetFont('');         $pdf->SetXY($x, $pdf->GetY() + $rowHeight);         $pdf->MultiCell(120, 120, $billing);         if($order->get_billing_phone()) {             $pdf->SetFont('', 'B');             $pdf->Cell(7, $rowHeight, "Tel:");             $pdf->SetFont('');             $pdf->Cell(10, $rowHeight, $order->get_billing_phone());             $pdf->SetXY($x, $pdf->GetY() + $rowHeight);             $offset += 20;         }         if($order->get_billing_email()) {             $pdf->SetFont('', 'B');             $pdf->Cell(10, $rowHeight, "Email: ");             $pdf->SetFont('');             $pdf->Cell(10, $rowHeight, $order->get_billing_email());             $pdf->SetXY($x, $pdf->GetY() + $rowHeight);             $offset += 20;         }         $pdf->SetXY($x + $xOffset, $y);         $pdf->SetFont('', 'B');         $pdf->Cell(20, $rowHeight, "Shipping address:");         $pdf->SetFont('');         $pdf->SetXY($x + $xOffset, $pdf->GetY() + $rowHeight);         $pdf->MultiCell(120, 120, $shipping);         $pdf->SetXY($x, $y + $offset);         remove_filter('woe_row_before_format_pdf', $addText);         return $hookRow;     };     add_filter('woe_row_before_format_pdf', $addText, 10, 1); }, 10, 2); |