Last active
June 10, 2020 07:32
-
-
Save plugin-republic/f3b4f5eae0188b74894416d8b03d0d8b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Filter the cart template path to use our cart.php template instead of the theme's | |
*/ | |
function csp_locate_template( $template, $template_name, $template_path ) { | |
$basename = basename( $template ); | |
if( $basename == 'cart.php' ) { | |
$template = trailingslashit( plugin_dir_path( __FILE__ ) ) . 'templates/cart.php'; | |
} | |
return $template; | |
} | |
add_filter( 'woocommerce_locate_template', 'csp_locate_template', 10, 3 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you!
This helps me a lot.
I found a generic way for my project:
After that, you could use the official way.
Of course your way more optimal for the best performance.
No doubt of that.