Support » Plugin: WooCommerce » Manual order & Variations

  • Resolved etisse


    Sorry for my english.

    When manually add order, the ajax selectdown menu to add product doesn’t anymore display the details of variations that we selected.
    Seems that 2 month ago and 2 updates before, it did.

    So now we have to add the product variation to see which one we selected. It timeworth.

    I try also with all plugin desactiveted except woocommerce and switch to default WordPress theme, same problem.

    Don’t know if it’s a bug or what.
    Can I do somethging by adding somewhat in functions.php? To have information of selected product variation before adding it
    Thanx for your reply

Viewing 3 replies - 1 through 3 (of 3 total)
  • So the AjAX search is kind of limited to hooking into it, but you can alter the results after the products are found and use that.

    The hook you are looking for is woocommerce_json_search_found_products

    I threw together a quick script that should do the trick for you.

    function ajax_product_search_custom_output($products){
    	foreach($products as $productId => $productDisplay){
    		$the_product = wc_get_product( $productId );
    		if ( 'variation' == $the_product->product_type ) {
    			$variation_data = array();
    			foreach($the_product->get_attributes() as $attr_key => $attr_val){
    				$variation_data[] = ucfirst($attr_key) .': ' . $attr_val;
    			$variation_data = implode(', ', $variation_data);
    			$products[$productId] .= '<br/>' . $variation_data;
    	return $products;
    • This reply was modified 2 years, 10 months ago by James.

    Great! Thanx a lot James, it works well


Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Manual order & Variations’ is closed to new replies.