Frequently Asked Questions
How to display Variation product on grid instead select variable option
Some use case, customer don't want select variation attribute, they want direct product on grid / search result. To do this , just simple add this filter code to your_active_theme/functions.php
And after done, just resync product list follow this way
And this is result:
if(!function_exists('custom_op_product_display_all')) { function custom_op_product_display_all($product_data,$product){ $product_data['display'] = true; $_product = wc_get_product($product_data['id']); if($_product) { if($_product->get_type() == 'variable') { $product_data['display'] = false; // option if you hide parent variable product } } if($product->post_type == 'product_variation') { $parent_id = $product->post_parent; if($parent_id) { $parent_product = wc_get_product($parent_id); $category = $parent_product->get_category_ids(); $product_data['categories'] = $category; } } return $product_data; } } add_filter('op_product_data','custom_op_product_display_all',100,2);
And after done, just resync product list follow this way
And this is result:
Last updated Wed, Sep 19 2018 6:50pm