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

WooCommerce lost password reset flow not working with SendGrid (redirect loop)

If you’re using SendGrid to process emails from WooCommerce and have click tracking enabled, links that use $_GET vars will break. Sendgrid uses a URL sanitizer that converts the &id= to &id= and that creates an issue in WooCommerce… The password reset form redirect looks for two get vars, $_GET[‘key’] and $_GET[‘id’], and if they’re … Read more

Query multiple post type and categories

The following code selects IDs of all posts type product and post, which belong to terms category-a or category-b, with taxonomy_01 and taxonomy_02, respectively. $args = [ ‘post_type’ => [‘product’,’post’], ‘posts_per_page’ => -1, ‘fields’ => ‘ids’, ‘tax_query’ => [ ‘relation’ => ‘OR’, [ ‘taxonomy’ => ‘taxonomy_01’, ‘field’ => ‘slug’, ‘terms’ => ‘category-a’, ‘include_children’ => false, … Read more

Display Categories Assigned to a WooCommerce Product

I have solved the issue with creating a list with http://codex.wordpress.org/Template_Tags/wp_list_categories changing style to list, then style it with CSS to my needs 🙂 <?php $taxonomy = ‘product_cat’; // get the term IDs assigned to post. $post_terms = wp_get_object_terms( $post->ID, $taxonomy, array( ‘fields’ => ‘ids’ ) ); if ( !empty( $post_terms ) && !is_wp_error( $post_terms … Read more

Fetch Product information in WooCommerce

Product Attributes without Variation Don’t Display in Shop page & Product Page Add Attribute and Variations in Product ( Refer blog ) Note : Product variations is Used Only Variable Product. And Then after put this code in function.php add_action( ‘woocommerce_after_shop_loop_item_title’, ‘bbloomer_echo_stock_variations_loop’ ); function bbloomer_echo_stock_variations_loop(){ global $product; if ( $product->get_type() == ‘variable’ ) { foreach … Read more

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