WooCommerce product sorting VERY slow
Here’s a plugin that deals with this fairly effectively. https://github.com/haydenw/woocommerce-product-sorting
Here’s a plugin that deals with this fairly effectively. https://github.com/haydenw/woocommerce-product-sorting
On woocommerce_available_variation hook the $args array doesn’t include input_value argument. Also You are not using has_term() conditional function in the right way for product categories. So try the following code instead: add_filter( ‘woocommerce_available_variation’, ‘customizing_available_variation’, 10, 3 ); // Variations function customizing_available_variation( $args, $product, $variation ) { if( has_term( ‘flyer’, ‘product_cat’, $product->get_id() ) ) { $args[‘max_qty’] … Read more
One approach would be to override woocommerce/templates/emails/email-order-items.php (and possibly the version for plain-text emails) with your own version. It has access to $sent_to_admin, so you could replace its call to echo wp_kses_post( apply_filters( ‘woocommerce_order_item_name’, $item->get_name(), $item, false ) ); with your own.
For “New” simple products on admin, the following embedded jQuery script will: trigger and enable “Stock management” at product level, set the “Stock quantity” to “1”, set the “Low stock threshold” to “0”. The code: add_action( ‘admin_footer’, ‘new_product_stock_default_setting’ ); function new_product_stock_default_setting() { global $pagenow, $post_type; // Targeting new product page (admin) if( $pagenow === ‘post-new.php’ … Read more
There is a lovely function get_term_link(), which you can use to get the any WP_Term object archive page URL. Just add this inside your foreach loop: $url = get_term_link( $attribute ); Edit Since you need to retrieve a certain meta value for each attribute, try fetching them all and var_dumping them, to see what is … Read more
I guess you should use your function on the hook woocommerce_add_to_cart instead of template_redirect Your function works fine for me. Try an alternative methow which also works: add_action(‘template_redirect’, function () { $product_id = 29690; foreach( WC()->cart->get_cart() as $key=>$item){ if($item[‘product_id’]==$product_id){ WC()->cart->remove_cart_item( $key ); } } // $product_cart_id = WC()->cart->generate_cart_id( $product_id ); // $cart_item_key = WC()->cart->find_product_in_cart( $product_cart_id … Read more
Ok so after some more searching online and using the right combination of search terms I stumbled across this guide here: https://www.themelocation.com/how-to-display-all-the-subcategories-from-a-specific-category-in-woocommerce/ From that guide I created this snippet of code that can be added to your theme’s functions.php file so that the subcategory list appears under the main category title in the main categories … Read more
WooCommerce Subscriptions: Show monthly Price for annual Product
I’m not familiar with Woocommerce, but in short, get_template_part() only look for template parts in parent and child themes, not in plugins. If you look at the source code, get_template_part() uses locate_template which have the following source code (which is where the actual template part is searched for) function locate_template($template_names, $load = false, $require_once = … Read more
Add the below code in your functions.php file of your current theme function render_product_description($item_id, $item, $order){ $_product = $order->get_product_from_item( $item ); echo “<br>” . $_product->post->post_content; } add_action(‘woocommerce_order_item_meta_end’, ‘render_product_description’,10,3);