• Resolved happyday25

    (@happyday25)


    Hello, I am having a display issue with the PDF Invoices & Packing Slips plugin when it comes to product add-ons (I’m using the YITH WooCommerce Product Add-ons & Extra Options plugin). Currently it is displaying the add-on prices on the packing slips when I need them to not show. Prior to updating, the prices weren’t visible but now they are.

    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

    • Add-on Item (+5.00)

    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!

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Contributor dwpriv

    (@dwpriv)

    Give this one a try

    add_action( 'wpo_wcpdf_custom_styles', 'wpo_wcpdf_hide_addon', 10, 2 );
    function wpo_wcpdf_hide_addon ( $document_type, $document ) {
        ?>
      
    	.packing-slip table.display_meta p span {
    		content: "-";
    	}
    	
        <?php
    }
    Thread Starter happyday25

    (@happyday25)

    Hi @dwpriv, thank you for the quick response. I gave this code snippet a try and no luck unfortunately. The price still shows and the dash was absent which seems like the class isn’t grabbing it.

    With the new code, the add-on item reads:

    Add-on title: Add-on item (+$5.00)

    The formatting I’m going for is:

    – Add-on item

    A variation with the title would be ok too, but the main thing is that I need to get rid of the price. Do you know a way to hide this with how the PDF Invoices & Packing Slips plugin is reading the data?

    • This reply was modified 10 months, 2 weeks ago by happyday25.
    Plugin Contributor dwpriv

    (@dwpriv)

    The snippet I sent was incorrect, actually. I meant to hide the price. Try this one

    add_action( 'wpo_wcpdf_custom_styles', 'wpo_wcpdf_hide_addon', 10, 2 );
    function wpo_wcpdf_hide_addon ( $document_type, $document ) {
        ?>
      
    	.packing-slip table.display_meta p span {
    		display: none;
    	}
    	
        <?php
    }

    If this doesn’t work. I’d want to take a closer look at your HTML. You use this guide here to turn on HTML view. Then you can save the output and link it here so that I can download it and take a look at it.

    Thread Starter happyday25

    (@happyday25)

    Thanks @dwpriv, still no luck with this code snippet either. I was able to output the HTML though and link it here (hopefully the link works ok) https://file.io/TdLfdUe2F8Iv.

    What I can’t figure out is why the classes in the first two modification in my original code work:

    .packing-slip .wc-item-meta li:before {
    		content: "-";
    	}
    .packing-slip .wc-item-meta-label {
    		display: none;

    But the third doesn’t:

    .woocommerce-Price-amount .amount {
    		display: none;
    	}

    It seems like an issue with how I’m calling the classes but can’t seem to figure out what combination it’s looking for.

    Plugin Contributor dwpriv

    (@dwpriv)

    Thanks for the file. Your third snippet should work like this:

    .woocommerce-Price-amount.amount {
    		display: none;
    	}

    Note that this will hide the number of the amount only. So your add on will look like “Add on item (+)”. This is because the brackets and “+” are not apart of the amount.

    Thread Starter happyday25

    (@happyday25)

    It works now and the price itself is hidden! It was the space between the two classes causing the issue. *facepalm*

    Thank you for the help!

    Plugin Contributor dwpriv

    (@dwpriv)

    No problem ??

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Add-on price displaying on packing slip’ is closed to new replies.