wpcfe_shipment_before_tracking_number_data

“wpcfe_shipment_before_tracking_number_data” is used for displaying the shipment number of the table row. Using this action hook it can be customized the display of the shipment number.

Copy and paste this sample code in the theme functions.php file.


// Remove the default shipment number display hook
remove_action( 'wpcfe_shipment_before_tracking_number_data', 'wpcfe_shipment_number_data_callback', 25 );
// Add "ABC" prefix and "XYZ" suffix
add_action( 'wpcfe_shipment_before_tracking_number_data', function( $shipment_id ){
    $page_url           = get_the_permalink( wpcfe_admin_page() );
    $shipment_title     = get_the_title($shipment_id);
    $is_seen            = wpcfe_is_seen_shipment( $shipment_id );
    $action_rows        = wpcfe_shipment_action_rows( $shipment_id );
    $badge              = !$is_seen ? sprintf( '<span class="badge badge-pill bg-danger align-top">%s</span>', __('New', 'wpcargo-frontend-manager' ) )  : '';
    $page_url           = !can_wpcfe_update_shipment() ? $page_url.'?wpcfe=track&num='.$shipment_title : $page_url.'?wpcfe=update&id='. (int)$shipment_id ;
    ob_start();
    ?>
        <td>
            <a href="<?php  echo esc_url( $page_url ); ?>" class="text-primary font-weight-bold">ABC - <?php echo esc_html($shipment_title) . $badge; ?> - XZY</a>
            <?php if( $action_rows ): ?>
                <div class="wpcfe-action-row">
                    <?php echo implode(" | ",$action_rows); ?>
                </div>
            <?php endif; ?>
        </td>
    <?php
    echo ob_get_clean();
}, 25 );

0
    0
    Your Cart
    Your cart is emptyReturn to Shop