I'm currently trying to show the product description inside the components of the Composite Products plugin. The Javascript option_id already throws out the right id-number at the right spot when being placed without the php. I just start struggling when I use the function.

<script type="text/template" id="tmpl-wc_cp_options_thumbnails">
function() {
  $product_id = '{{ data[ index ].option_id }}';
  $product = wc_get_product( $product_id );
  $product_description = $product->get_description();
  echo esc_html( $product_description );

Can someone see what I did wrong with the code?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.