• Resolved Riccardo

    (@rdmgrl)


    I’ve add the code that i’ve found in the FAQ to add image to delivery note but functions.php generate an error in the server.

    Are you sure that the code you’ve posted is ok?

    function example_product_image( $product ) {
    if( isset( $product->get_id() ) && ( ” !== $product->get_id() ) && has_post_thumbnail( $product->get_id ) ) {
    echo get_the_post_thumbnail(
    $product->get_id(),
    array( 40, 40 ),
    array( ‘loading’ => false )
    );
    }
    }
    add_action( ‘wcdn_order_item_before’, ‘example_product_image’ );

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hello @rdmgrl

    You should double check the characters you have used, as is not equal to '' and these ‘’ are not ''.

    This should be working:

    function example_product_image( $product ) {
    if ( isset( $product->get_id() ) && ( '' !== $product->get_id() ) && has_post_thumbnail( $product->get_id ) ) {
    echo get_the_post_thumbnail(
    $product->get_id(),
    array( 40, 40 ),
    array( 'loading' => false )
    ); } }
    add_action( 'wcdn_order_item_before', 'example_product_image' );

    Regards,
    Endre

    Plugin Author priyankajagtap

    (@priyankajagtap)

    Hi @rdmgrl,

    Below is the code snippet you can use to display the product images in the invoice and the delivery notes.

    /**
    Add this code snippet in the functions.php file of your currently active theme.
    An example that adds a 40px large product image.
    */
    function example_product_image( $product ) {
    if( isset( $product->id ) && has_post_thumbnail( $product->id ) ) {
    echo get_the_post_thumbnail( $product->id, array( 40, 40 ) );
    }
    }
    add_action( 'wcdn_order_item_before', 'example_product_image' );


    You can add this code snippet to your currently active theme’s “functions.php” file. You can make changes to it as per your requirements.

    Please check and let us know if you have any further questions.

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.