| @@ -608,16 +608,23 @@ | ||
| 608 | 608 | return [$site]; |
| 609 | 609 | } |
| 610 | 610 | |
| 611 | 611 | /** |
| 612 | + * Retrieve the blog name for a given site. | |
| 613 | + * | |
| 614 | + * Falls back to the site domain if the blog name is empty | |
| 615 | + * to prevent merchant creation failures on the Route API. | |
| 616 | + * | |
| 612 | 617 | * @param $site |
| 613 | - * @return mixed | |
| 618 | + * @return string The blog name or domain as fallback. | |
| 614 | 619 | */ |
| 615 | 620 | private static function get_blog_name($site) |
| 616 | 621 | { |
| 617 | - if (is_multisite()) | |
| 618 | - return get_blog_option($site->blog_id, 'blogname'); | |
| 619 | - return get_option('blogname'); | |
| 622 | + $name = is_multisite() | |
| 623 | + ? get_blog_option($site->blog_id, 'blogname') | |
| 624 | + : get_option('blogname'); | |
| 625 | + | |
| 626 | + return empty($name) ? $site->domain : $name; | |
| 620 | 627 | } |
| 621 | 628 | |
| 622 | 629 | /** |
| 623 | 630 | * @param $site |