• Good morning, with the new version of the plugin, we are seeing issues with printing and with the ability to add custom metadata to the receipt. We’re currently holding at 6.0 until we can resolve.

    First, custom metadata. We had added a custom metadata field to all products in the previous version using the below snippet. It no longer works, is there a version that we can use for the new version?

    // @desc: adds product tag/bin to reciept
    add_action( 'wcdn_order_item_after', 'add_product_tag_to_reciept' );
    function add_product_tag_to_reciept( $product ) {
    $binr = $product->get_meta('r8_bin'); //get bin for receipt
    echo "

    BIN: " . $binr . ""; //add bin to receipt
    }

    Secondly, the new version seems to add a lot of padding/margin to the left of the receipt and does not honor the end of page on the right. See attached image.

    Here is our old receipt format for reference

    Can you assist?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support anjitha21

    (@anjitha21)

    Hi @mindtakerminis

    Sorry for the inconvenience caused with the recent update.

    Thank you for explaining the issues in detail. The space issues were sorted out in the new version v7.1.2 which was released last week.

    Regarding the custom data, there were so many codebase improvements performed. Therefore, the template file changed.

    Here are the steps for the template override in the new version:

    Open your active theme folder: wp-content/themes/your-theme/
    Create a folder named woocommerce-delivery-notes inside it

    1. Find the template file you want to change inside the plugin: wp-content/plugins/woocommerce-delivery-notes/templates/
    2. Copy that file into the folder you created in step 2, keeping the same filename
    3. Edit the copied file in your theme — the plugin will use it automatically

    Available template files:

    • invoice.php — Invoice
    • receipt.php — Receipt
    • deliverynote.php — Delivery Note
    • packingslip.php — Packing Slip
    • creditnote.php — Credit Note
    • base.php — Shared layout used by all documents

    Override styles
    Find the CSS file you want to change inside the plugin: wp-content/plugins/woocommerce-delivery-notes/templates/css/

    1. Copy it into your theme, recreating the same folder structure under woocommerce-delivery-notes/css/
    2. Edit the copied file — your styles will be loaded instead of the plugin’s

    Available CSS files:

    • css/style.css — Applies to all documents
    • css/html/style.css — Applies to browser print only
    • css/pdf/style.css — Applies to PDF output only

    Notes

    • If using a child theme, create the folder in the child theme — not the parent
    • The override affects only the live print preview and the document PDF generation. The frontend preview on the admin page isn’t affected.

    Please try from your end and let us know if there are any further questions.

    Thread Starter mindtakerminis

    (@mindtakerminis)

    Will the same code snippet work if placed in the template.php?

    Plugin Support anjitha21

    (@anjitha21)

    Hi @mindtakerminis

    The old code may not work correctly with the new customization file because the wcdn_order_item_after hook arguments were changed in v7.x.

    Previously it passed ( $product, $order, $item ), but now it passes ( $item, $order, $template ), so $product->get_meta() will no longer work directly and the callback needs to be updated accordingly.

    Our developer have modified the code according to the new hook arguments introduced in v7.0.

    This updated version should work correctly with the latest customization file.

    // @desc: adds product tag/bin to receipt
    add_action( 'wcdn_order_item_after', 'add_product_tag_to_receipt', 10, 3 );

    function add_product_tag_to_receipt( $item, $order, $template ) {

    if ( ! is_a( $item, 'WC_Order_Item_Product' ) ) {
    return;
    }

    $product = $item->get_product();

    if ( ! $product ) {
    return;
    }

    $binr = $product->get_meta( 'r8_bin' ); // Get bin for receipt.

    if ( ! empty( $binr ) ) {
    echo '<p><strong>BIN:</strong> ' . esc_html( $binr ) . '</p>';
    }
    }
    Thread Starter mindtakerminis

    (@mindtakerminis)

    Great, I’ll try it over the next week and get back to you.

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

You must be logged in to reply to this topic.