document.querySelectorAll(".some-class").forEach(cont=>{
cont.querySelector(".error-count").innerHTML = Array.from(cont.querySelectorAll(".delivery-table-item")).filter(e=>e.getAttribute("data-status")=="Ошибка").length;
});
$(".some-class").each((i,el)=>{
$(el).find(".error-count").html($(el).find(".delivery-table-item[data-status=Ошибка]").length);
})
add_action( 'woocommerce_product_options_pricing', 'custom_woocommerce_product_options_pricing' );
function custom_woocommerce_product_options_pricing() {
$price_index = '_custom_price';
woocommerce_wp_text_input(
array(
'id' => $price_index,
'value' => get_post_meta( get_the_ID(), $price_index, true ),
'data_type' => 'price',
'label' => __( 'Custom price', 'woocommerce' ) . ' (' . get_woocommerce_currency_symbol() . ')'
)
);
}
add_action( 'woocommerce_admin_process_product_object', 'custom_woocommerce_admin_process_product_object', 10, 1 );
function custom_woocommerce_admin_process_product_object( $product ) {
$price_index = '_custom_price';
$price = wc_clean( wp_unslash( $_POST[ $price_index ] ) );
update_post_meta( $product->get_id(), $price_index, $price );
}
$price_index = '_custom_price';
echo wc_price( get_post_meta( get_the_ID(), $price_index, true ) );
$(document).ready(function(){
if(window.location.href.indexOf('qwerty') > -1){
$('.blockclass').addClass('class');
}
});
// jQuery
$(".submenu ul li").each(({ target }) => {
if ($(target).hasClass("active")) {
$(target).closest(".submenu").addClass("vision");
}
});
// ES6 syntax
document.querySelectorAll(".submenu ul li").forEach(({ target }) => {
if (target.className.includes("active")) {
target.closest(".submenu").classList.add("vision");
}
});