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
- Find the template file you want to change inside the plugin:
wp-content/plugins/woocommerce-delivery-notes/templates/
- Copy that file into the folder you created in step 2, keeping the same filename
- 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/
- Copy it into your theme, recreating the same folder structure under
woocommerce-delivery-notes/css/
- 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.
Will the same code snippet work if placed in the template.php?
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>';
}
}
Great, I’ll try it over the next week and get back to you.