• Resolved Payment Plugins

    (@mrclayton)


    Hi Cartflows,

    I have run in to an issue where your use of the filter override_woo_template is overriding templates that are not part of the WooCommerce domain.

    For instance, if another plugin happens to have a template called checkout/payment-method.php' your code will override that template because the path matches the same template name located in the cart flows'woocommerce/template` folder. Here is the code from your plugin:

    
    public function override_woo_template( $template, $template_name, $template_path ) {
    
    		global $woocommerce;
    
    		$_template = $template;
    
    		$plugin_path = CARTFLOWS_DIR . 'woocommerce/template/';
    
    		if ( file_exists( $plugin_path . $template_name ) ) {
    			$template = $plugin_path . $template_name;
    		}
    
    		if ( ! $template ) {
    			$template = $_template;
    		}
    
    		return $template;
    	}
    

    I believe your plugin should only be overriding templates located within the WooCommerce domain. Here is an example of how you can achieve this:

    public function override_woo_template( $template, $template_name, $template_path ) {
    
    		global $woocommerce;
    
    		if ( 'woocommerce/' !== $template_path ) {
    			return $template;
    		}
    		
    		$_template = $template;
    
    		$plugin_path = CARTFLOWS_DIR . 'woocommerce/template/';
    
    		if ( file_exists( $plugin_path . $template_name ) ) {
    			$template = $plugin_path . $template_name;
    		}
    
    		if ( ! $template ) {
    			$template = $_template;
    		}
    
    		return $template;
    	}

    Kind Regards,

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Override WooCommerce Template Error’ is closed to new replies.