Change WooCommerce registration form/way?

I’ve been trying out the same code snippet from Cloudways as well. If you don’t use the snippet in functions.php, but instead create a copy of the woocommerce file form-login.php in your child theme’s folder/woocommerce/myaccount. Then the fields from the Couldways snippet can be used before the line containing: <?php do_action( ‘woocommerce_after_checkout_billing_form’, $checkout ); ?>

Hook for single product thumbnail

Here’s what I believe is an updated version of one of the other answers’ comments. This function replaces the width and height attributes, but OP wanted to change the src. I imagine the solution would be similar, except using preg_replace to replace the src instead. add_action(‘woocommerce_single_product_image_thumbnail_html’,’remove_single_product_image_attrs’,10,2); function remove_single_product_image_attrs( $sprintf, $post_id ){ return preg_replace( ‘/(width|height)=”\d*”\s/’, “”, … Read more

Send a custom notification to customer on WooCommerce cancelled order status

A better solution will be to use all arguments included in woocommerce_order_status_cancelled hooked function, so the missing $order variable. Also as the action hook woocommerce_order_status_cancelled is triggered when order status change to “cancelled”, so in your code, if ($order->has_status(‘cancelled’)) { is not needed. Then your code will be: add_filter(‘woocommerce_order_status_cancelled’, ‘woocommerce_send_mail_abandonned_order’, 10, 2 ); function woocommerce_send_mail_abandonned_order( … Read more

How to add plus minus button on Input Quantity box Woocommerce? [closed]

Below code snippet will display Plus & Minus Quantity Buttons @ WooCommerce Single Product Page. Reference /** * @snippet Plus Minus Quantity Buttons @ WooCommerce Single Product Page * @how-to Watch tutorial @ https://businessbloomer.com/?p=19055 * @sourcecode https://businessbloomer.com/?p=90052 * @author Rodolfo Melogli * @compatible WooCommerce 3.5.1 * @donate $9 https://businessbloomer.com/bloomer-armada/ */ // ————- // 1. Show … Read more

reusing code in function and running it with loop

You would need to set up the function like this in your functions.php function my_function(){ //your function in here include(TEMPLATEPATH . ‘[variable][1].php’); } And then in your loop you would call it like so: $args = array( ‘post_type’ => ‘product’, ‘posts_per_page’ => 4, ); $featured_query = new WP_Query($args); if ($featured_query->have_posts()) { while ($featured_query->have_posts()) { $featured_query->the_post(); … Read more

Link Back to Parent Category – Woocommerce

get_ancestors() seems like the function you need. If given an ID and object type, it will return an array of ancestor IDs with the first being the most distant parent/grandparent/great-grandparent/etc and the last being the immediate parent. You can use that information to construct your link. function parent_id_wpse_142550($object_id,$type) { $anc = get_ancestors($object_id,$type); $parent = array_shift($anc); … Read more