Hello atlasfire.
Sorry about that, forget that link. You can use the following and modify it to your needs. It registers a new custom shortcode that can be used in WPLA profiles. To use it, just enter [product_brands_list] to any of the profile fields and it will be replaced with the brand(s) associated with the product.
add_action( 'wp_loaded', 'register_product_brands_shortcode' );
function register_product_brands_shortcode() {
wpla_register_profile_shortcode( 'product_brands_list', 'Product Brands', 'my_product_brands_list' );
WPLA()->logger->info( 'product_brands_list shortcode registered' );
}
function my_product_brands_list( $product_id ) {
WPLA()->logger->info( 'my_products_brands_list for ID: '. $product_id );
$brands_tax = wp_get_object_terms( $product_id, 'product_brand', array( 'fields' => 'names' ) );
WPLA()->logger->info( 'Found brands: '. print_r( $brands_tax, true ) );
if ( ! is_wp_error( $brands_tax ) ) {
return implode( ', ', $brands_tax );
}
WPLA()->logger->info( 'Error gettings brands: '. $brands_tax->get_error_message() );
return '';
}
You will need to customize that based on your taxonomy. You can put the correct taxonomy in this line:
$brands_tax = wp_get_object_terms( $product_id, 'product_brand', array( 'fields' => 'names' ) );
Kind regards,
John