Strip string from $_product->get_title() to get a cleaner mini-cart

You need to add a function in your theme’s functions.php file that will find and remove those two words “shorts” and “longshorts” from a php string. Then you can add that function as a filter to the woocommerce_cart_item_name event that is being applied in your mini-cart.php Try something like: function wpse_remove_shorts_from_cart_title( $product_name ) { $product_name … Read more

Custom action not working in Woocommerce

It looks like your call to remove_action() has too many parameters. https://codex.wordpress.org/Function_Reference/remove_action Also, your call to add_action() is set to allow 0 parameters but your woocommerce_breadcrumb() definition expects one so you need to fix that mismatch. https://codex.wordpress.org/Function_Reference/add_action I haven’t run the code locally but those are the only issues I’m seeing. I hope that helps … Read more

Woocommerce purchase date [closed]

I think your making it way too hard to save and extract that information from the database. I recommend you use a custom meta field for order, something like this: //Save it after the process add_action( ‘woocommerce_checkout_update_order_meta’, ‘purchase_date_save’ ); function purchase_date_save( $order_id ) { $get_current_date_time = date(‘Y-m-d’); update_post_meta( $order_id, ‘my_purchase_date’, sanitize_text_field( $get_current_date_time ) ); } … Read more

Disable woocommerce product search plugin’s autocomplete [closed]

You can do this by adding this bit of jQuery code, for example at your footer.php, right before the </body> tag closure: <script> $(‘input.field’).attr(‘autocomplete’, ‘off’); </script> Or the same thing but with pure JavaScript: <script> var x = document.querySelectorAll(“input.search-field”); for (i = 0; i < x.length; i++) { x[i].autocomplete=”off” } </script> This will add autocomplete=”off” … Read more

Woocommerce Register Error

First you need to add a hidden field to registration form which can hold the URL where you want to redirect the user post registration. Below code will help you for that: <?php add_action( ‘register_form’, ‘hiddern_redirect_url’ ); function hiddern_redirect_url() { ?> <input type=”hidden” name=”redir_post_register” value=”<?php echo get_site_url(); ?>” /> <?php } ?> Then, using woocommerce_registration_redirect … Read more