How to change WooCommerce loop product title HTML output in single product page and archive page

The main problems with what you’ve got are tha your close bracket } for the is_product() case is in the wrong place: it should be before the elseif not at the bottom of the block. (This is what Tom meant by indenting your code correctly: if you’d indented each {…}, which your IDE will do … Read more

How to add order status class to the body tag?

This does the trick add_filter( ‘body_class’, ‘order_class’); function order_class( $orderclasses ) { $user_id = get_current_user_id(); // The current user ID // Get the WC_Customer instance Object for the current user $customer = new WC_Customer( $user_id ); // Get the last WC_Order Object instance from current customer $last_order = $customer->get_last_order(); $order_id = $last_order->get_id(); // Get the … Read more

Send email notifications to a defined email address depending if a product in order has a specific TAG [closed]

To check product has TAG or not you have to fetch product from order and search in them. //Custom NEW ORDER Email address depending on Product Tag add_filter( ‘woocommerce_email_recipient_new_order’, ‘new_order_conditional_email_recipient’, 10, 2 ); function new_order_conditional_email_recipient( $recipient, $order ) { if ( ! is_a( $order, ‘WC_Order’ ) ) return $recipient; // (Optional) // Get the order … Read more

get_the_post_thumbnail_url does not return anything if image size is set

The first parameter for get_the_post_thumbnail_url() is the post ID or post object, and not the image size which is actually the second parameter. So: // Instead of this: get_the_post_thumbnail_url( ‘thumbnail’ ) // You should use: get_the_post_thumbnail_url( get_the_ID(), ‘thumbnail’ ) // pass a post ID get_the_post_thumbnail_url( get_post(), ‘thumbnail’ ) // or post object // Or you … Read more

Search in 1) Post, 2) Products (woocommerce) and 3) Custom post type or Taxonomy type on a single page

I believe you cannot achieve it in the same loop. Instead, you should have three loops, each setting WP_Query criteria differently (setting WP_Query arguments to filter for Post, Products and Custom Taxonomy). Howevery, you want to save initial search parameters in variable(s), so you could apply them to those three different loops as other parts … Read more

How to upload WP user avatar on woocommerce account page [closed]

Ok, now it’s time to get your hands dirty. Open up your functions.php file located in wp-content/themes/your-theme-name/ and add this code in it: /** * Print the customer avatar in My Account page, after the welcome message */ function storefront_myaccount_customer_avatar() { $current_user = wp_get_current_user(); echo ‘<div class=”myaccount_avatar”>’ . get_avatar( $current_user->user_email, 72, ”, $current_user->display_name ) . … Read more