wordpress - Create a filter in woocommerce -


this issue, working on wordpress, using datafeedr woocommerce importer import products datafeedr woocomemerce. when add new product set, information brand in woocommerce products brand not display. there way can import brands , create filter products brand? want create filter merchants.

you need add brand attribute products , pull brand attribute, e.g.

<?php /* add brand attribute product */ add_filter( 'dfrpswc_product_attributes', 'mycode_add_brand_attribute', 20, 5 ); function mycode_add_brand_attribute( $attributes, $post, $product, $set, $action ) {     if ( isset( $product['brand'] ) ) {         $attr = 'brand';         if ( !isset( $attributes[sanitize_title( $attr )] ) ) {             $attributes[$attr]['name'] = $attr;         }     }     return $attributes; }  /**  * set value "brand" attribute.  */ add_filter( 'dfrpswc_filter_attribute_value', 'mycode_set_brand_attribute_value', 30, 6 ); function mycode_set_brand_attribute_value( $value, $attribute, $post, $product, $set, $action ) {     if ( isset( $product['brand'] ) ) {         $attr = 'brand';         if ( $attribute == $attr ) {             $value = $product['brand'];         }     }     return $value; } 

Comments

Popular posts from this blog

hibernate - How to load global settings frequently used in application in Java -

python 3.x - Mapping specific letters onto a list of words -

objective c - Ownership modifiers with manual reference counting -