Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save xlplugins/1d30a9d6d5b02e3dcd3e0580f7817e9f to your computer and use it in GitHub Desktop.

Select an option

Save xlplugins/1d30a9d6d5b02e3dcd3e0580f7817e9f to your computer and use it in GitHub Desktop.
A shortcode snippet prepare to output shipment tracking UI on WooCommerce Thank You page.
<?php
/**
* Shortcode snippet prepare to output shipment tracking UI on WooCommerce Thank You page.
* Required: WooCommerce Shipment Tracking - https://woocommerce.com/products/shipment-tracking/
* Required: NextMove - WooCommerce Thank You Page - xlplugins.com/woocommerce-thank-you-page-nextmove/
*/
function wc_shipment_tracking_by_xlplugin($atts) {
if (isset($_REQUEST['order_id']) && $_REQUEST['order_id'] != '') {
$html = '';
$order_id = $_REQUEST['order_id'];
if (function_exists('XLWCTY_Core')) {
$order = XLWCTY_Core()->data->get_order();
if ($order instanceof WC_Order) {
$st = new WC_Shipment_Tracking_Actions();
ob_start();
echo '<style>.xlwcty_Box h2{font-size:20px;line-height:26px}</style>';
$st->display_tracking_info($order_id);
$html = ob_get_clean();
}
}
}
return $html;
}
add_shortcode('xl_shipment_tracking', 'wc_shipment_tracking_by_xlplugin');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment