Guest User

Untitled

a guest
Aug 24th, 2017
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.54 KB | None | 0 0
  1. function jas_gecko_os_locate_template( $located, $template_name, $args, $template_path, $default_path ) {
  2.     if ( $template_name == 'single-product/add-to-cart/variable.php' ) {
  3.         global $post;
  4.  
  5.         $tmp = get_post_meta( $post->ID, '_allow_openswatch', true );
  6.         if ( $tmp != 0 ) {
  7.             // Change the path to new template file here
  8.             return get_stylesheet_directory_uri() . 'your_file_here.php';
  9.         }
  10.     }
  11.     return $located;
  12. }
  13. add_filter( 'wc_get_template','jas_gecko_os_locate_template', 20, 5 );
Add Comment
Please, Sign In to add comment