Plugin Contributor
Ewout
(@pomegranate)
Hi Wekhter,
This should be possible, but I don’t have Chained Products. The product bundle classes are added by using the wpo_wcpdf_item_row_class
filter (check code here), you could do the same.
If you want to know which data you have available, you could (temporarily) output the item data in the invoice with the following filter (added to functions.php):
add_filter( 'wpo_wcpdf_order_item_data', 'wpo_wcpdf_write_item_data', 10, 2 );
function wpo_wcpdf_write_item_data ( $item, $order ) {
$item['name'] = '<pre>'.print_r( $item['item'], true ).'</pre>';
return $item;
}
You’ll probably need to enable HTML output in the status tab because the plugin may otherwise choke trying to create the PDF.
Let me know what you find and I’ll add the necessary code to the plugin. You can also email me at support@wpovernight.com.
Ewout
Thanks for steering me in the right direction!
It looks like the class for Chained Products is SA_WC_Chained_Products and the data attached to each chained item is _chained_product_of. (Product Bundles has metadata for the parent product as well as for the bundled items, but Chained Products only has metadata for the items that are chained.)
By copying the code you pointed out as well as the code looking for the plugin class I was able to add a class to the chained items, but I’d really appreciate a plugin update for our live sites. Thanks!
Plugin Contributor
Ewout
(@pomegranate)
Thanks for sharing! If you can also share your chained products styles, that’d be great 🙂
Hi, I got exact same problem. I want to hide/remove all table row have chained_item class from my order admin page or just in invoice file only (see my screenshot below).
View post on imgur.com
Could you help me to achieve this using hooks? Thanks you very much.
Plugin Contributor
Ewout
(@pomegranate)
Hi Nuphero,
The plugin actually has the hooks implemented: the chained products are ‘tagged’ with the CSS class ‘chained-product’. You can hide this with the following CSS:
.chained-product { display: none; }
Check out the documentation for using custom styles: http://docs.wpovernight.com/woocommerce-pdf-invoices-packing-slips/using-custom-styles/
Hope that helps!
@wekhter can you share your chained product styles with us? That would really help! Perhaps the same styles that are used for product bundles could be applied? i.e.:
.order-details tr.chained-product td.product {
padding-left: 5mm;
}
.order-details tr.chained-product td {
border: 0;
}
Is there any meta data indicating that a product has chained products underneath it?
Let me know!
Ewout
wow, thanks for your fast respond, solve my problem right away. I just need to add !important to hide chained product meta data
add_action( 'wpo_wcpdf_custom_styles', 'wpo_wcpdf_custom_styles' );
function wpo_wcpdf_custom_styles () {
?>
.chained-product { display: none !important; }
<?php
}
I’ll take a look at your premium templates and buy it. Thanks a lot.
Plugin Contributor
Ewout
(@pomegranate)
Glad to hear it works 🙂
With the premium templates you can even enter this code directly in the settings (bottom of the customizer page).
Thanks for the review!
Ewout
Sorry, but the same code to hide chained product I’ve used above seems doesn’t work anymore (maybe since I updated lasted version of your plugin)
Another problem is code to display custom fields seems doesn’t work neither. Here is screenshot of my code (http://take.ms/3rURG), and here is the result (http://take.ms/zb2Pb).
I’m using both lastest version of WP and Woo. Please help. Thanks.