Skip to content

Instantly share code, notes, and snippets.

@bporcelli
Created March 7, 2022 13:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bporcelli/67e48551f16228bb32d1c1886d2b7aa9 to your computer and use it in GitHub Desktop.
Save bporcelli/67e48551f16228bb32d1c1886d2b7aa9 to your computer and use it in GitHub Desktop.
[Table Rate Shipping] Adds support to override the shipping table list template by copying it to a theme
<?php
/**
* Makes it possible to override the TRS table list template by copying
* it to `table-rate-shipping/shipping-table-list.php` in a theme.
*
* @param string $template_path Path to TRS table list template.
*
* @return string Template path.
*/
function filter_trs_tables_template_path( $template_path ) {
$override = locate_template( array( 'table-rate-shipping/shipping-table-list.php' ) );
if ( $override ) {
$template_path = $override;
}
return $template_path;
}
add_filter( 'trs_table_list_view_path', 'filter_trs_tables_template_path' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment