cococat11
Forum Replies Created
-
Forum: Plugins
In reply to: [WooCommerce] Bulk renaming customers at onceHello,
I would like to ask if it is possible to “overwrite” customers’ information by importing their information again but leaving the names part blank? I understand how removing all customer information and re-importing would work, but doing so would also remove their points under the woocommerce points and rewards plugin. Thanks again.
I did a bit more testing and I’ve discovered that the following code partially works:
add_filter('posts_clauses', 'order_by_stock_status'); function order_by_stock_status($posts_clauses) { global $wpdb; // only change query on WooCommerce loops if (is_woocommerce() && (is_shop() || is_product_category() || is_product_tag() || is_product_taxonomy())) { $posts_clauses['join'] .= " INNER JOIN $wpdb->postmeta istockstatus ON ($wpdb->posts.ID = istockstatus.post_id) "; $posts_clauses['orderby'] = " istockstatus.meta_value ASC, " . $posts_clauses['orderby']; $posts_clauses['where'] = " AND istockstatus.meta_key = '_stock_status' AND istockstatus.meta_value <> '' " . $posts_clauses['where']; } return $posts_clauses; }
Let’s say that I’m trying to look for products under a certain brand,
1. The code works fine when loading in content via WooCommerce Brands, e.g. mystore.com/brands/this-is-a-brand
2. The code does not immediately work when loading in content via the search box (search queries) in the header, e.g. mystore.com/?s=this-is-a-brandFor the second case, what I have noticed is that if I pick another product sorting order other than default, then switch back to the default sorting order, the out of stock products will appear at the end of the search query instead,
i.e. mystore.com/?orderby=menu_order&paged=1&s=this-is-a-brand works as intended.Hello, I have tried running both code snippets from the StackOverflow link with Elementor disabled. Unfortunately they did not work ??
I have just tried running the website with just WooCommerce, Elementor, and the Twenty-Twenty theme, and this issue still persists.
Hello @margaretwporg ,
Thank you for your response. As I noted at the start of the thread, one of the solutions did work for me in the past. I am not sure about this, but I suspect it may have something to do with upgrading the site from PHP v7.4 to v8.0.
Speaking of which, there are also a number of logs that start with fatal-error, the log from today reads:
2022-08-15T01:48:06+00:00 CRITICAL Uncaught Error: Call to undefined function ElementorPro\Modules\Woocommerce\Widgets\wc_print_notices() in /var/www/wp-content/plugins/elementor-pro/modules/woocommerce/widgets/products.php:398 Stack trace: #0 /var/www/wp-content/plugins/elementor/includes/base/controls-stack.php(2223): ElementorPro\Modules\Woocommerce\Widgets\Products->render() #1 /var/www/wp-content/plugins/elementor/includes/base/widget-base.php(609): Elementor\Controls_Stack->render_by_mode() #2 /var/www/wp-content/plugins/elementor/includes/base/widget-base.php(750): Elementor\Widget_Base->render_content() #3 /var/www/wp-content/plugins/elementor/includes/base/element-base.php(447): Elementor\Widget_Base->print_content() #4 /var/www/wp-content/plugins/elementor/includes/base/element-base.php(787): Elementor\Element_Base->print_element() #5 /var/www/wp-content/plugins/elementor/includes/base/element-base.php(447): Elementor\Element_Base->print_content() #6 /var/www/wp-content/plugins/elementor/includes/base/element-base.php(787): Elementor\Element_Base->print_element() #7 /var/www/wp-content/plugins/elementor/includes/base/element-base.php(447): Elementor\Element_Base->print_content() #8 /var/www/wp-content/plugins/elementor/core/base/document.php(1627): Elementor\Element_Base->print_element() #9 /var/www/wp-content/plugins/elementor/core/base/document.php(1078): Elementor\Core\Base\Document->print_elements(Array) #10 /var/www/wp-content/plugins/elementor/includes/frontend.php(1092): Elementor\Core\Base\Document->print_elements_with_wrapper(Array) #11 /var/www/wp-content/plugins/elementor/includes/frontend.php(1006): Elementor\Frontend->get_builder_content(11) #12 /var/www/wp-includes/class-wp-hook.php(307): Elementor\Frontend->apply_builder_in_content('<style>/*! elem...') #13 /var/www/wp-includes/plugin.php(191): WP_Hook->apply_filters('<style>/*! elem...', Array) #14 /var/www/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php(1811): apply_filters('the_content', '<style>/*! elem...') #15 /var/www/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php(560): WP_REST_Posts_Controller->prepare_item_for_response(Object(WP_Post), Object(WP_REST_Request)) #16 /var/www/wp-includes/rest-api/class-wp-rest-server.php(1143): WP_REST_Posts_Controller->get_item(Object(WP_REST_Request)) #17 /var/www/wp-includes/rest-api/class-wp-rest-server.php(990): WP_REST_Server->respond_to_request(Object(WP_REST_Request), '/wp/v2/pages/(?...', Array, NULL) #18 /var/www/wp-includes/rest-api/class-wp-rest-server.php(414): WP_REST_Server->dispatch(Object(WP_REST_Request)) #19 /var/www/wp-includes/rest-api.php(394): WP_REST_Server->serve_request('/wp/v2/pages/11') #20 /var/www/wp-includes/class-wp-hook.php(307): rest_api_loaded(Object(WP)) #21 /var/www/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters(NULL, Array) #22 /var/www/wp-includes/plugin.php(524): WP_Hook->do_action(Array) #23 /var/www/wp-includes/class-wp.php(398): do_action_ref_array('parse_request', Array) #24 /var/www/wp-includes/class-wp.php(770): WP->parse_request('') #25 /var/www/wp-includes/functions.php(1330): WP->main('') #26 /var/www/wp-blog-header.php(16): wp() #27 /var/www/index.php(17): require('/var/www/wp-blo...') #28 {main} thrown 於 /var/www/wp-content/plugins/elementor-pro/modules/woocommerce/widgets/products.php 在 398 線上