Template structure & Overriding templates via a Plugin

[eye_row data_bg_parallax_ratio=”0.5″ data_bg_size=”cover” data_bg_attachment=”scroll” data_bg_repeat=”no-repeat” data_bg_position=”top center” data_bg_type=”classic” data_margin_row=”0,0,0,0″ data_padding_row=”0,0,0,0″ data_gutters=”30px” data_col_nested=”no” data_container_fluid_xx_large=”100%” data_container_fluid_x_large=”100%” data_container_fluid_large=”100%” data_container_fluid_medium=”100%” data_container_fluid_small=”100%” data_container_fluid_extra_samll=”100%” data_cont=”fluid” data_shortcode_id=”mlbkvcn8zf”][eye_column data_width=”0-12-0″ data_desktop=”0″ data_tablet=”0″ data_mobile=”0″ data_offset_xl=”0″ data_offset_lg=”0″ data_offset_md=”0″ data_offset_sm=”0″ data_order_xl=”0″ data_order_lg=”0″ data_order_md=”0″ data_order_sm=”0″ data_bg_position=”top center” data_bg_repeat=”no-repeat” data_bg_attachment=”scroll” data_bg_size=”cover” data_bg_parallax_ratio=”0.5″ data_shortcode_id=”8rb4o8t6bw”][eye_text shortcode_id=”zvx4xtnqtp” main_tab=”undefined” button_tab_right=”undefined” font_type=”system” font_devices=”undefined” size_xxl_type=”px” size_xxl_px=”1″ size_xl_type=”px” size_xl_px=”1″ size_lg_type=”px” size_lg_px=”1″ size_md_type=”px” size_md_px=”1″ size_sm_type=”px” size_sm_px=”1″ text_align=”left” font_line_height=”undefined” line_height_xxl_type=”px” line_height_xxl_px=”1″ line_height_xl_type=”px” line_height_xl_px=”1″ line_height_lg_type=”px” line_height_lg_px=”1″ line_height_md_type=”px” line_height_md_px=”1″ line_height_sm_type=”px” line_height_sm_px=”1″ font_letter_spacing=”undefined” letter_spacing_xxl_type=”px” letter_spacing_xxl_px=”1″ letter_spacing_xl_type=”px” letter_spacing_xl_px=”1″ letter_spacing_lg_type=”px” letter_spacing_lg_px=”1″ letter_spacing_md_type=”px” letter_spacing_md_px=”1″ letter_spacing_sm_type=”px” letter_spacing_sm_px=”1″ devices=”undefined” padding_row_xl=”0,15px,0,15px” padding_row_lg=”0,15px,0,15px” padding_row_md=”0,15px,0,15px” padding_row_sm=”0,15px,0,15px” bgopt=”undefined” bg_type=”classic” bg_position=”top center” bg_repeat=”no-repeat” bg_attachment=”scroll” bg_size=”cover” bg_parallax_ratio=”0.5″ heading_css=”undefined” classes=”alert alert-warning” heading_js=”undefined”]

Note: This is a Developer level doc. If you are unfamiliar with code/templates and resolving potential conflicts, select a WooExpert or Developer for assistance. We are unable to provide support for customizations under our Support Policy.

[/eye_text][eye_text shortcode_id=”tmw15efmev” main_tab=”undefined” button_tab_right=”undefined” font_type=”system” font_devices=”undefined” size_xxl_type=”px” size_xxl_px=”1″ size_xl_type=”px” size_xl_px=”1″ size_lg_type=”px” size_lg_px=”1″ size_md_type=”px” size_md_px=”1″ size_sm_type=”px” size_sm_px=”1″ text_align=”left” font_line_height=”undefined” line_height_xxl_type=”px” line_height_xxl_px=”1″ line_height_xl_type=”px” line_height_xl_px=”1″ line_height_lg_type=”px” line_height_lg_px=”1″ line_height_md_type=”px” line_height_md_px=”1″ line_height_sm_type=”px” line_height_sm_px=”1″ font_letter_spacing=”undefined” letter_spacing_xxl_type=”px” letter_spacing_xxl_px=”1″ letter_spacing_xl_type=”px” letter_spacing_xl_px=”1″ letter_spacing_lg_type=”px” letter_spacing_lg_px=”1″ letter_spacing_md_type=”px” letter_spacing_md_px=”1″ letter_spacing_sm_type=”px” letter_spacing_sm_px=”1″ devices=”undefined” padding_row_xl=”0,15px,0,15px” padding_row_lg=”0,15px,0,15px” padding_row_md=”0,15px,0,15px” padding_row_sm=”0,15px,0,15px” bgopt=”undefined” bg_type=”classic” bg_position=”top center” bg_repeat=”no-repeat” bg_attachment=”scroll” bg_size=”cover” bg_parallax_ratio=”0.5″ heading_css=”undefined” heading_js=”undefined”]

WooCommerce template files contain the markup and template structure for frontend and HTML emails of your store.

define( 'EYE__PLUGIN_DIR', plugin_dir_path( __FILE__ ) );

add_filter( 'woocommerce_locate_template', 'plugin_woocommerce_locate_template', 10, 3 );

function plugin_woocommerce_locate_template( $template, $template_name, $template_path ) {

global $woocommerce;

$_template = $template;

if ( ! $template_path ) $template_path = $woocommerce->template_url;

$plugin_path = EYE__PLUGIN_DIR . '/woocommerce/';

// Look within passed path within the theme - this is priority
$template = locate_template(
array(
$template_path . $template_name,
$template_name
)
);

// Modification: Get the template from this plugin, if it exists
if ( ! $template && file_exists( $plugin_path . $template_name ) )
$template = $plugin_path . $template_name;

// Use default template
if ( ! $template )
$template = $_template;

// Return what we found
return $template;
}

[/eye_text][/eye_column][/eye_row]

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>