show wc_add notices on particular page in woo commerce custom plugin development

I solve this problem below is code. add_action( ‘woocommerce_init’, array( $this, ‘afwo_add_notices’ ) ); public function afwo_add_notices() { if ( isset( $_POST[‘whatsapp_cart_nonce_field’] ) && wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST[‘whatsapp_cart_nonce_field’] ) ), ‘whatsapp_cart_field’ ) ) { echo ”; } if ( empty( WC()->session->get( ‘WhatsApp_cart’ ) ) ) { return; } if ( isset( $_GET[‘index_to_remove’] ) ) { … Read more

How do I add filter with woocommerce categories?

I was missing the condition for the array inside the tax_query array. It is important to have it regardless if you have one or more conditions. $term_search = get_queried_object()->slug; // WP_Query arguments $args = array( ‘p’ => ‘product’, ‘post_type’ => array( ‘product’ ), ‘order’ => ‘ASC’, ‘post_per_page’ => 20, ‘tax_query’ => array(array( ‘taxonomy’ => ‘product_cat’, … Read more

“add to cart” links css class “ajax_add_to_cart” doesn’t show in woocommerce in widget sidebar

At last i solved it myself. Hope someone will get benefit form this answer. I merge $default variables all array (quantity, class, attributes) directly into link. I changed whole block of if ( $product ) {}. if ( $product ) { $output .= sprintf( ‘<a href=”%s” data-quantity=”1″ class=”%s” %s>%s</a>’, esc_url( $product->add_to_cart_url() ), esc_attr( implode( ‘ … Read more

WordPress Custom Post Loop

First of all why do you call wp_reset_query() on each while iteration? Then we simply will create new $cats array and check if new “category” is not already there = then show and add it to the array. <ul class=”filter filter-top”> <li class=”active”><a href=”#” data-filter=”*”>All</a></li> <?php $portfolio_args_custom = array( ‘post_type’ => ‘portfolio’, ); $cats = … Read more

How to properly enqueue jQuery knob on WordPress without conflict?

If you want to just enqueue a script by name then you have to register it first with wp_register_script: wp_register_script( ‘jquery-knob’, plugins_url( ‘assets/js/jquery.knob.min.js’, __FILE__ ), array( ‘jquery’ ), ‘1.2.11’ ); : wp_enqueue_script( ‘jquery-knob’ ); However that’s only really useful when you’re registering a script to be available as a dependency for other scripts, which I … Read more