<?php

function woocoommerce_content() {
    ?>
    <p class="product-description"><?php echo wp_trim_words(strip_tags(get_the_content()), 15); ?></p>
    <?php
}

// Get Product Decsription on empty cart page
function fetch_product_description() {
    if (isset($_POST['product_id'])) {
        $product_id = intval($_POST['product_id']);
        $product = wc_get_product($product_id);
        
        if ($product) {
            // Get the product description
            $description = wp_trim_words(strip_tags($product->get_description()), 15);
            echo esc_html($description);
        }
    }
    wp_die(); // Always include this in AJAX functions
}
