Request for complete list of shortcodes available in the plugin

Forums PDF Invoicing for WooCommerce Request for complete list of shortcodes available in the plugin

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #169499
    Marek Mitko
    Participant

    Hi,
    I’m currently customizing the invoice templates using the PDF Invoices & Packing Slips Generator for WooCommerce plugin and would like to ask:

    Could you please provide a full list of all available shortcodes supported by the plugin (both standard and advanced/custom ones)?
    I’m particularly interested in shortcodes that return:

    • Item-level tax (e.g. item_single_tax)
    • Item-level total tax (e.g. item_total_tax)

    If there is any documentation or reference guide that contains all shortcode variables and formatting options, please share the link as well.

    Thanks in advance!

    #176960
    Roland Jungwirth
    Participant

    Did you ever get an answer to this?

    #176965
    Roland Jungwirth
    Participant

    The one thing that I found is this code: https://github.com/wpcodefactory/pdf-invoicing-for-woocommerce/blob/master/includes/class-alg-wc-pdf-invoicing-shortcodes.php – the available shortcodes are in the array prop_aliases.

    #177349
    Taha
    Moderator
    Plugin Support

    Hello Marek and Roland,

    I hope you are doing well. Please accept our sincere apologies for the delayed response. Here is an update regarding your request for custom tax shortcodes in the PDF invoice.

    Available Shortcodes:

    • Item-level total tax: This can be used directly with the shortcode [item_total_tax].

    • Item-level tax per item: There is no default shortcode for this, but you can add a custom shortcode by implementing the following PHP snippet:

    add_shortcode( 'item_single_tax', function ( $atts ) {
    
    	// Check if WooCommerce PDF Invoicing plugin exists
    	if ( ! function_exists( 'alg_wc_pdf_invoicing' ) ) {
    		return ''; // PDF plugin not active
    	}
    
    	// Check if shortcodes class exists
    	if ( ! isset( alg_wc_pdf_invoicing()->core->shortcodes ) ) {
    		return '';
    	}
    
    	// Execute [item_qty] shortcode and get the value
    	$qty = do_shortcode( '[item_qty]' );
    
    	// Prevent division by zero
    	if ( empty( $qty ) || $qty == 0 ) {
    		return '';
    	}
    
    	// Execute [item_total_tax] shortcode with divide attribute
    	$total_tax = do_shortcode( "[item_total_tax divide='{$qty}']" );
    
    	// Return properly formatted
    	return alg_wc_pdf_invoicing()->core->shortcodes->return_prop( $total_tax, $atts );
    } );
    • Once this snippet is added to your theme’s functions.php file or via a code snippet plugin, you can use [item_single_tax] in your PDF HTML template.

    Guidance Screenshots:
    For visual guidance, please refer to the attached screenshots:

    Best regards,
    Taha

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.