How to Customize Quotation in Shipment Invoice

Note: Copy following codes into your functions.php of your active theme.

		/*
		 * Remove the default hook of Parcel Qutation
		 */
		add_action( 'init', 'remove_invoice_default_hook');
		function remove_invoice_default_hook(){
			remove_action( 'wpcfe_end_invoice_section', 'wpcpq_invoice_section', 999, 1);
		}

		/*  
		 * You can custmize the default code now
		 */
		add_action( 'wpcfe_end_invoice_section', 'wpcfe_end_invoice_section_custom_callback', 999, 1);
		function wpcfe_end_invoice_section_custom_callback( $shipmentDetails ){
			$shipment_id = $shipmentDetails['shipmentID'];
			$wpc_pq_currency = get_currency_symbol( get_option( 'wpc_pq_currency' ) );
			$shipment_type = get_post_meta( $shipment_id, '__shipment_type', true );
			if( !empty( wpcpq_package_additional_charges() ) && $shipment_type == 'parcel-quotation'  ){
				?>
				<tr>
					<td colspan="2">
						<p style="font-size:1.2rem;margin-bottom:18px;"><strong><?php esc_html_e('QUOTATION:', 'wpcargo-parcel-quotation'); ?></strong></p>
						<table id="quotation-table" style="width:50%;">
							<?php foreach( wpcpq_package_additional_charges() as $additional_charges_name => $additional_charges ): ?>
								<?php
									$value = ( get_post_meta( $shipment_id, $additional_charges_name, TRUE) ) ? : 0 ;
									$total_cost  += $value;
								?>
								<tr class="additional-detail">
									<td class="label" style="font-size: 12px; padding: 5px;"><strong><?php echo $additional_charges['label']; ?></strong></td>
									<td class="value" style="font-size: 12px; padding: 5px;">
										<span><?php echo pq_format_value( $value ); ?></span>
									</td>
								</tr>
							<?php endforeach; ?>
							<tr id="total-cost" class="additional-detail" style="text-transform:uppercase; color:#900;">
								<td class="label" style="font-size: 12px; border-top: 1px solid #000; padding: 5px;"><strong><span><?php echo wpcpq_shipment_estimated_charges_label(); ?></span></strong></td>
								<td class="value" style="font-size: 12px; border-top: 1px solid #000; padding: 5px;"><span id="currecy" class="value"><?php echo $wpc_pq_currency; ?></span> <span id="cost" ><?php echo pq_format_value($total_cost); ?></span></td>
							</tr>
						</table>
					</td>
				</tr>
				<?php
			}
		}
	
0
    0
    Your Cart
    Your cart is emptyReturn to Shop