Shortcode with product catgory counter

Try this: (add it to the theme’s main functions.php file) add_shortcode( ‘products-counter’, ‘products_counter’ ); function products_counter( $atts ) { $atts = shortcode_atts( [ ‘category’ => ”, ], $atts ); $taxonomy = ‘product_cat’; if ( is_numeric( $atts[‘category’] ) ) { $cat = get_term( $atts[‘category’], $taxonomy ); } else { $cat = get_term_by( ‘slug’, $atts[‘category’], $taxonomy ); … Read more

Show attribute description when filtering by that attribute

You need to check when filter is enabled and take selected attribute taxonomy, ‘pa_brand’ in this case: add_action( ‘woocommerce_before_shop_loop’, ‘desc_before’, 75 ); function desc_before() { if (is_filtered()) { $brands = WC_Query::get_layered_nav_chosen_attributes() [‘pa_brand’]; if ( isset($brands) ) { foreach ($brands[‘terms’] as $term ) { $term_obj = get_term_by(‘slug’, $term, ‘pa_brand’); echo ‘<div class=”ka-attr-description”>’. ‘<h4>’ . $term_obj ->name … Read more

Woocommerce add custom button to backend order table

@mmm thanks for that code, I didnt know this filter yet. Do you know if it is also possible to add a tooltip that way? Anyway, I have a different solution to add a new button to this column, and also want to post it: add_action( ‘woocommerce_admin_order_actions_end’, ‘add_content_to_wcactions_column’ ); function add_content_to_wcactions_column() { // create some … Read more

Hide some items from Screen options in dashboard for products

The best option would be to use CSS to hide these columns and fields. Add this in your admin.css file to hide the SKU column table.wp-list-table .column-sku { width: 10% } To hide options in Screen Options add the following CSS in admin.css .metabox-prefs label:nth-child(2), .metabox-prefs label:nth-child(11), .metabox-prefs label:nth-child(12) { display: none; } FYI to … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)