https://demo.letsgodev.com/ptable/short ... uct-table/
Я затем создал виджет Elementor, который использует один и тот же короткометражный код для отображения таблицы продуктов WC, и он работает, но список.
Код: Выделить всё
Uncaught TypeError: Cannot read properties of undefined (reading 'childNodes')
Я пытался использовать крючки элементарных
Код: Выделить всё
jQuery( window ).on( 'elementor/frontend/init', () => {
const addHandler = ( $element ) => {
//elementorFrontend.elementsHandler.addHandler( ContentToggleButton, { $element, } );
console.log('hello');
console.log($element);
console.log( $element.find( 'table tbody' ).html() );
const wcProductTable = new List( 'wc-product-table', {
valueNames: ['image', 'name', 'stock', 'stock_status', 'qty', 'price', 'rating', 'variations', 'cart', 'price_raw', 'rating_raw', 'sales_raw', 'creation_raw'],
page: 11,
pagination: true
} );
};
elementorFrontend.hooks.addAction( 'frontend/element_ready/wc_product_table.default', addHandler );
} );
< /code>
и, только для тестирования, я использовал Settimeout с 6 секундами (чтобы ждать загрузки всей страницы), и ошибка была такой же. < /p>
setTimeout( () => {
const wcProductTable = new List( 'wc-product-table', {
valueNames: ['image', 'name', 'stock', 'stock_status', 'qty', 'price', 'rating', 'variations', 'cart', 'price_raw', 'rating_raw', 'sales_raw', 'creation_raw'],
page: 11,
pagination: true
} );
}, 6000 );
Подробнее здесь: https://stackoverflow.com/questions/795 ... e-products