Support » Plugin: Print Invoice & Delivery Notes for WooCommerce » print-content.php needs to account for item meta that are PHP classes

  • Resolved Paul Biron

    (@pbiron)


    templates/print-order/print-content.php has a check for whether the item_meta is an array and skips it if true, but some plugins (e.g, Woocommerce Partial Orders Pro) store PHP classes in item meta resulting in a PHP fatal error in those cases.

    There are multiple ways to prevent the fatals, but one would be to replace lines 164-166 with:

    
    if ( ! is_string( $value ) ) {
    	if ( is_object( $value ) && method_exists( $value, '__toString' ) ) {
    		$value = strval( $value );
    	} else {
    		continue;
    	}
    }
    
    • This topic was modified 1 year, 3 months ago by Paul Biron. Reason: fix typo
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support kenil802

    (@kenil802)

    Hi @pbiron,

    Thank you for sharing the code.

    I will need to ask your query to the developer so, I will get back to you once I hear from them.

    Regards,
    Kenil Shah

    Plugin Support kenil802

    (@kenil802)

    Hi @pbiron,

    Apologies for the delay in response.

    Regarding the query, we will update this in the next release of the plugin.

    Regards,
    Kenil Shah

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘print-content.php needs to account for item meta that are PHP classes’ is closed to new replies.