<?php

function filtroTienda(){
    $rProducts = get_posts( array(
        'post_type' => 'product',
        'post_status' => 'publish',
        'posts_per_page' => -1, 
    ) );
    $productsWithTaxonomy = [];
    $productt = '';
    foreach($rProducts as $product){
        $productt = wc_get_product($product->ID);
        $price = $productt->get_price_html();
        array_push($productsWithTaxonomy,array(
            'id' => $product->ID,
            'post_title' => $product->post_title,
            'post_name' => $product->post_name,
            'link' => get_the_permalink($product->ID),
            'post_thumbnail' => get_the_post_thumbnail_url($product->ID),
            'price' => $price,
            'terms' => get_the_terms($product->ID, 'product_cat'),
            'type' => 'product'
            // ''
        ));
    }
    print_r(json_encode($productsWithTaxonomy));
    die();
}

?>