I want to put variable with product id in quotes of html quotes.
if ( ! function_exists( 'woocommerce_template_loop_product_link_open' ) ) {
/**
* Insert the opening anchor tag for products in the loop.
*/
function woocommerce_template_loop_product_link_open() {
global $product;
$id = $product->get_id();
$link = apply_filters( 'woocommerce_loop_product_link', get_the_permalink(), $product );
echo '<a href="#" class="yith-wcqv-button" data-product_id="$id">';
}
}
$id
should be in data-product_id="$id"
but I don’t know how to do this
2
Answers
String interpolation requires double quotes. You’re close.
We have different ways to do that.