//Include package fields in email template in update shipment
//You can add you inline CSS to the template
function my_package_shortcode_metakey( $tags ){
$tags['{wpc-multiple-package}'] = "WPCargo Package";
return $tags;
}
add_filter( 'wpc_email_meta_tags', 'my_package_shortcode_metakey', 999 );
function my_package_shortcode_metavalue( $meta_value, $shortcode, $post_id){
if( $shortcode != 'wpc-multiple-package' ){
return $meta_value;
}
$meta_value = maybe_unserialize( $meta_value );
ob_start();
if( empty( $meta_value ) ){
return '';
}
?>
<ul>
<?php foreach ( $meta_value as $value): ?>
<?php if( !is_array( $value ) ) { continue; } ?>
<li>
<ul>
<?php foreach( wpcargo_package_fields() as $_key => $_value ): ?>
<?php $val = array_key_exists( $_key, $value ) ? $value[$_key] : '' ; ?>
<li><?php echo $_value['label'] ?>: <?php echo $val; ?></li>
<?php endforeach; ?>
</ul>
</li>
<?php endforeach; ?>
</ul>
<?php
return ob_get_clean();
}
add_filter( 'wpcargo_shortcode_meta_value', 'my_package_shortcode_metavalue', 10, 3 );