/**
 * 1. Catch Main WooCommerce Page Templates (Shop, Single Product, Archives)
 */
add_filter('template_include', function ($template) {
    if (function_exists('is_woocommerce')) {
        
        // Single Product
        if (is_product() && file_exists(get_stylesheet_directory() . '/views/woocommerce/single-product.blade.php')) {
            echo view('woocommerce.single-product');
            exit;
        }

        // Shop / Category / Tag Archives
        if ((is_shop() || is_product_taxonomy()) && file_exists(get_stylesheet_directory() . '/views/woocommerce/archive-product.blade.php')) {
            echo view('woocommerce.archive-product');
            exit;
        }
    }

    return $template;
}, 99);

/**
 * 2. Catch Inner WooCommerce Partials & Subfolder Templates (Cart, Checkout, My Account, Loop items)
 */
add_filter('wc_get_template', function ($located, $template_name, $args, $template_path, $default_path) {
    // Convert template name (e.g., "cart/cart.php") to Blade notation ("woocommerce.cart.cart")
    $clean_name = str_replace('.php', '', $template_name);
    $blade_view = 'woocommerce.' . str_replace('/', '.', $clean_name);

    $file_path = get_stylesheet_directory() . '/views/' . str_replace('.', '/', $blade_view) . '.blade.php';

    if (file_exists($file_path)) {
        echo view($blade_view, is_array($args) ? $args : []);
        // Return dummy empty file so WC does not render its original PHP file on top
        return get_stylesheet_directory() . '/views/empty-fallback.php';
    }

    return $located;
}, 10, 5);<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet type="text/xsl" href="//saascsoftware.com/wp-content/plugins/wordpress-seo/css/main-sitemap.xsl"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
	<sitemap>
		<loc>https://saascsoftware.com/page-sitemap.xml</loc>
		<lastmod>2026-07-22T22:40:30+00:00</lastmod>
	</sitemap>
	<sitemap>
		<loc>https://saascsoftware.com/product-sitemap.xml</loc>
		<lastmod>2026-07-29T21:22:59+00:00</lastmod>
	</sitemap>
	<sitemap>
		<loc>https://saascsoftware.com/product_cat-sitemap.xml</loc>
		<lastmod>2026-07-29T21:22:59+00:00</lastmod>
	</sitemap>
</sitemapindex>
<!-- XML Sitemap generated by Yoast SEO -->