0

I want to select content(text) of this tags(such as:"First content",...) with php. How I should do this?

<div class="woocommerce-variation single_variation">
    <div class="woocommerce-variation-description"> 
        First content
    </div>
    <div class="woocommerce-variation-price">
        Second content
    </div>
    <div class="woocommerce-variation-availability">
        Third content
    </div>      
</div>
Julien Marrec
  • 11,605
  • 4
  • 46
  • 63

1 Answers1

0

Php does not work like java-script, Javascript reads what is already compiled and php does the compiled output, so to select things you want to edit, you need to find the source of where this block of code is getting called and displayed.

for Woo-commerce variation products you can template out the code you showed above by copying the variable.php content in your plugin 'woocommerce/templates/single-product/add-to-cart/variable.php' and create a copy inside your current theme at 'your-theme/woocommerce/single-product/add-to-cart/variable.php'

after that you can start changing the code on this page however you like just make sure to keep the woo-commerce input controls.

vico
  • 2,152
  • 2
  • 17
  • 38