Brands Field not linking to WP-Lister For Ebay
-
Does anybody use this plugin in conjunction with WP-Lister Pro for ebay? When I map the field Brand to Brand as shown in the attached screenshot it does not work. It is instead simply adding “Does Not Apply” like it does with any product that doesn’t have a required attribute.
I contacted WP-Lister who provided the below code as a potential fix, but doesn’t seem to have worked. Anyone have ideas on this?
// add custom attribute to WP-Lister
add_filter( ‘wple_custom_attributes’, ‘my_filter_wplister_custom_attributes’ );
function my_filter_wplister_custom_attributes( $attributes ) {$attributes[] = array(
‘label’ => ‘Brand (Taxonomy)’,
‘id’ => ‘_my_brand’,
‘callback’ => ‘my_filter_wplister_get_brand_name’
);return $attributes;
}// get brand name for product (callback function)
function my_filter_wplister_get_brand_name( $post_id, $listing_id ) {// get array of brands (taxonomy terms) for $post_id
$brands = get_the_terms( $post_id, ‘product_brand’ );
if ( ! is_array($brands) ) return ”;
if ( empty($brands) ) return ”;// return name of first brand
return $brands[0]->name;
}
- The topic ‘Brands Field not linking to WP-Lister For Ebay’ is closed to new replies.