add_filter( 'wpo_wcpdf_order_items_data', 'woosb_combine_products', 999 );
function woosb_combine_products( $data_list ) {
$products = [];
foreach ( $data_list as $key => $data ) {
$bundles = wc_get_order_item_meta( $data['item_id'], '_woosb_ids', true );
if ( ! empty( $bundles ) ) {
// hide bundles
unset( $data_list[ $key ] );
}
if ( ! in_array( $data['product_id'], array_values( $products ) ) ) {
$products[ $key ] = $data['product_id'];
} else {
foreach ( $products as $k => $p ) {
if ( $p == $data['product_id'] ) {
// update quantity
$data_list[ $k ]['quantity'] += $data['quantity'];
}
}
// remove exist product
unset( $data_list[ $key ] );
}
}
return $data_list;
}
Upon enabling debug mode, I’ve identified the following error message: “Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 32768 bytes) in /var/www/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/vendor/dompdf/dompdf/lib/Cpdf.php on line 5628.”
Despite increasing the memory limit to 256MB, the issue persists. My business involves selling custom items, where customers attach their artwork for printing. The invoice typically displays the uploaded artwork alongside each product. It appears that when customers order multiple items, each with its associated artwork, the plugin fails to generate the PDF.
Any assistance in resolving this matter would be greatly appreciated.
]]>When inspecting the order page that shows the products in an order along with an add-on product on the admin side, here is what the HTML looks like:
<div class ="view">
<table cellspacing="0" class="display_meta">
<tbody>
<tr>
<th>Add-on title:</th>
<td>
<p>
"Add-on Item (+"
<span class="woocommerce-Price-amount amount">
<span class="woocommerce-Price-currencySymbol">$</span>
"5.00"
</span>
")"
</p>
</td>
</tr>
</tbody>
</table>
</div>
When generating a packing slip for the order, the items read like this:
Product
This is the code I currently have in my functions.php, but it doesn’t seem to be grabbing the class hide the price:
add_action( 'wpo_wcpdf_custom_styles', 'wpo_wcpdf_hide_addon', 10, 2 );
function wpo_wcpdf_hide_addon ( $document_type, $document ) {
?>
.packing-slip .wc-item-meta li:before {
content: "-";
}
.packing-slip .wc-item-meta-label {
display: none;
}
.woocommerce-Price-amount .amount {
display: none;
}
<?php
}
Do you know why this method might not be working or if there is another way I might be able to achieve hiding the price on the packing slip?
Thank you!
]]>I am in the process of customising an invoice template.
It uses a 3rd-party plugin called Woocommerce Delivery & Pickup Date Time, from Coderockz.
From this, I would like to display the delivery or pickup date, via a meta_key.
This works!
I’m using [wcj_order_meta meta_key=’pickup_date’] and [wcj_order_meta meta_key=’delivery_date’]
My question is whether I can format this meta_key date? Display currently is ‘2023-10-20’. I would like to change this to ’20-10-2023′ or even ‘Friday 20-10-2023’ / ‘Friday 20 October 2023’.
Is this possible with via the meta_key shortcode?
Can I also use boolean of if statements to conditionally show either one or the other, depending on the shipping method?
Thanks in advance for any help!
Kind regards,
Frank
I have customers who order virtual products at the same time that they order physical products. The virtual products show up on the packing slip when I then mail them their physical items, but if possible, I would prefer only the items in the package to be listed on the packing slip.
Is it possible to exclude products that are part of the “virtual” category from appearing on the Packing Slip I generate for one of these kinds of orders?
]]>