I
I
IgFil2020-11-26 10:44:48
WordPress
IgFil, 2020-11-26 10:44:48

Why is the html output code not working in the woocommerce product card?

function add_custom_html() {        
            $content = "
                    <table>
                        <tr>
                            <th>Наименование</th>
                            <th>Скидка от 1000р</th>
                            <th>Скидка от 50000р</th>
                            <th>Скидка от 100000р</th>
                      <th>Скидка от 500000р</th>
                      <th скидка от 1000000р</th>
                        </tr>

                        <tr>
                            <td>Arton</td>
                            <td>17%</td>
                            <td>20%</td>
                            <td>22%</td>
                      <td>24%</td>
                      <td>26%</td>
                        </tr>

                        <tr>
                            <td>Deton Universal Classic</td>
                            <td>4%</td>
                            <td>6%</td>
                            <td>12%</td>
                      <td>16%</td>
                      <td>23%</td>
                        </tr>

                        <tr>
                            <td>Deton Universal Akril</td>
                            <td>4%</td>
                            <td>6%</td>
                            <td>12%</td>
                      <td>16%</td>
                      <td>23%</td>
                        </tr>
                    
                    </table>
            
                ";
            
                echo $content;
 }
function __construct() {
     add_action( 'woocommerce_single_product_summary', array( &$this, 'add_custom_html' ), 15 );
}

This code doesn't work. What am I doing wrong. I am trying to display a table in a woocommerce product card5fbf5ce7b96e2880641690.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pychev Anatoly, 2020-11-26
@IgFil

Remove the ampersand before this array( &$this, 'add_custom_html' )
Check if your class is included and if the constructor is called
Add scope publicto your hook handler function.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question