• Resolved cangle

    (@cangle)


    I narrowed this error down to this code in my functions.php file but I am unsure how to update it.

    Can you help?

    add_action( ‘wpo_wcpdf_after_order_details’, ‘woocommerce_invoice_gift_message’, 10, 2 );
    function woocommerce_invoice_gift_message ($template_type, $order) {
    global $wpo_wcpdf;
    if ($template_type == ‘invoice’) {
    ?>

    custom_field(‘Gift Message’, “Gift Message:
    “); ?>
    <?php
    }
    }

Viewing 1 replies (of 1 total)
  • Plugin Contributor Yordan Soares

    (@yordansoares)

    Hi @cangle,

    Replace your outdated code with this one:

    /**
     * PDF Invoices & Packing Slips for WooCommerce:
     * Display the gift message after the order details
     */
    
     add_filter( 'wpo_wcpdf_after_order_details', function( $address, $document ) {
    	if ( ( $order = $document->order ) && ( $gift_message = $order->get_meta( 'Gift Message' ) ) ) {
    		$address .= sprintf( '<p>Gift Message: %s</p>', $gift_message ); 
    	}
    	return $address;
    }, 10, 2 );

    Please note that this happened because you are using deprecated code that we started removing on the latest version. Actually, these legacy code is very old, and we kept them for long time in order to provide support old WooCommerce versions. However, since WooCommerce started bumping the minimal requirements, we chose to follow the same approach.

Viewing 1 replies (of 1 total)
  • The topic ‘Error 200: parsererror’ is closed to new replies.