Hi @ictorgarcia45
i’ve been messing around with this and created a snippet that replaces the {product_id} from the shortcode with the actual product ID (on single product pages. This works for me.
add_shortcode('dynamic_woosw', function () {
global $post;
if (!function_exists('do_shortcode') || !is_singular('product')) {
return '';
}
$product_id = $post->ID;
if (!$product_id || get_post_type($product_id) !== 'product') {
return '';
}
return do_shortcode('[woosw id="' . esc_attr($product_id) . '"]');
});
You can then use the shortcode [dynamic_woosw] anywhere you want where the post id of the product is being loaded. @janilyn409 maybe you could implement this in another way aswell?
Cheers, Thomas