Remove the variation after the product name
-
On the PDF Invoice shows the name of the product plus the variation. But on a new line come again the variation.
Inspektionsdeckel aus Kunststoff 205 mm – Schwarz
Farben:
SchwarzHow can i take of the first variation that is after der product name?
Thanks for helping!
-
Hi @caredesign,
This is the default behavior on WooCommerce. However, with this code snippet, the variation attributes will be removed from the product title:
/** * WooCommerce: * Remove the variation attributes from the product title ** add_filter( 'woocommerce_product_variation_title_include_attributes', '__return_false' ); add_filter( 'woocommerce_is_attribute_in_product_name', '__return_false' );
If you haven’t worked with code snippets (actions/filters) or
functions.php
before, read this guide: How to use filtersThank you, but this didn’t help.
In the Admin Order i wish to see the Attributes, Thats how it is
Inspektionsdeckel aus Kunststoff 205 mm – Schwarz
Artikelnummer:?17.291
ID der Variante:?9528
Farben:
SchwarzBut on the PDF Invoice i dont want the attributes show after the name.
Inspektionsdeckel aus Kunststoff 205 mm – Schwarz
Farben:
SchwarzThanks for the help
Thanks for explaining better, @caredesign:
Please remove the code above, and try this code snippet instead:
/** * PDF Invoices & Packing Slip for WooCommerce: * Add custom styles to the PDF documents */ add_action( 'wpo_wcpdf_custom_styles', function( $document_type, $document ) { ?> /* Hide item meta */ .wc-item-meta { display:none; } <?php }, 10, 2 );
Thanks….i placed it in the snippet but the page generating the pdf invoice stays blank.
Could you please tell me where are you placing the code snippet, that is, in the
functions.php
file or using a plugin like Code Snippets?In the Plugin Code Snippets
Thanks for confirming, @caredesign:
If you are using the Code Snippets plugin, please note that you have to click on the “Save Changes and Activate” button (in the editing mode), instead on the right one that only save the changes, but not activate the code:
Of course. :-)….As without the code the invoice will be created, as soon as i activate the snippet the invoice will be not created.
Could you please show me a screenshot of the code snippet in the editing view, to try to understand what is happening?
yes of course
It seems that you pasted the code snippet correctly.
Anyway, try removing the comment above the CSS rule, to rule out that this is causing the issue in your site*:
/** * PDF Invoices & Packing Slip for WooCommerce: * Add custom styles to the PDF documents */ add_action( 'wpo_wcpdf_custom_styles', function( $document_type, $document ) { ?> .wc-item-meta { display:none; } <?php }, 10, 2 );
* I have double-checked the code in a staging site, and it is working correctly.
add_action( ‘wpo_wcpdf_custom_styles’, function( $document_type, $document ) {
?>
.wc-item-meta {
display:none;
}
<?php
}, 10, 2 );I did this one now……. but still causing the problem.
I found this, maybe helps….. This shows when i have the white page instead of the PDF invoice
<style type="text/css"> <div style="border: 2px solid red; padding: 5px;"> <h3>Fatal error: Too few arguments to function {closure}(), 1 passed in /var/www/vhosts/web324.login-8.loginserver.ch/httpdocs/--shop/test/wp-includes/class-wp-hook.php on line 324 and exactly 2 expected</h3> <pre>/var/www/vhosts/web324.login-8.loginserver.ch/httpdocs/--shop/test/wp-content/plugins/code-snippets/php/snippet-ops.php(582) : eval()'d code (1)</pre> <pre>#0 /var/www/vhosts/web324.login-8.loginserver.ch/httpdocs/--shop/test/wp-includes/class-wp-hook.php(324): {closure}() #1 /var/www/vhosts/web324.login-8.loginserver.ch/httpdocs/--shop/test/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters() #2 /var/www/vhosts/web324.login-8.loginserver.ch/httpdocs/--shop/test/wp-includes/plugin.php(517): WP_Hook->do_action() #3 /var/www/vhosts/web324.login-8.loginserver.ch/httpdocs/--shop/test/wp-content/themes/Avada-Child-Theme/woocommerce/pdf/YCN-Business/html-document-wrapper.php(33): do_action() #4 /var/www/vhosts/web324.login-8.loginserver.ch/httpdocs/--shop/test/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/includes/documents/abstract-wcpdf-order-document.php(990): include('...') #5 /var/www/vhosts/web324.login-8.loginserver.ch/httpdocs/--shop/test/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/includes/documents/abstract-wcpdf-order-document.php(928): WPO\WC\PDF_Invoices\Documents\Order_Document->render_template() #6 /var/www/vhosts/web324.login-8.loginserver.ch/httpdocs/--shop/test/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/includes/documents/abstract-wcpdf-order-document.php(894): WPO\WC\PDF_Invoices\Documents\Order_Document->wrap_html_content() #7 /var/www/vhosts/web324.login-8.loginserver.ch/httpdocs/--shop/test/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/includes/documents/abstract-wcpdf-order-document.php(845): WPO\WC\PDF_Invoices\Documents\Order_Document->get_html() #8 /var/www/vhosts/web324.login-8.loginserver.ch/httpdocs/--shop/test/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/includes/documents/abstract-wcpdf-order-document.php(911): WPO\WC\PDF_Invoices\Documents\Order_Document->get_pdf() #9 /var/www/vhosts/web324.login-8.loginserver.ch/httpdocs/--shop/test/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/includes/class-wcpdf-main.php(423): WPO\WC\PDF_Invoices\Documents\Order_Document->output_pdf() #10 /var/www/vhosts/web324.login-8.loginserver.ch/httpdocs/--shop/test/wp-includes/class-wp-hook.php(324): WPO\WC\PDF_Invoices\Main->generate_pdf_ajax() #11 /var/www/vhosts/web324.login-8.loginserver.ch/httpdocs/--shop/test/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters() #12 /var/www/vhosts/web324.login-8.loginserver.ch/httpdocs/--shop/test/wp-includes/plugin.php(517): WP_Hook->do_action() #13 /var/www/vhosts/web324.login-8.loginserver.ch/httpdocs/--shop/test/wp-admin/admin-ajax.php(188): do_action() #14 {main}</pre> </div>
Thanks for sending that error trace.
Could you please check under Plugins > Installed Plugins, and tell me which version of our plugin you have installed?
Hi Yordan
I have the Version 3.5.6.
Could you please try updating to the latest version, which is 3.7.7?
- The topic ‘Remove the variation after the product name’ is closed to new replies.