The default behavior for WooCommerce breadcrumbs when you have multiple categories selected for a product is to grab the first one found in the list. If you’re making use of the Primary Category options provided by the Yoast SEO plugin WooCommerce will ignore that setting. Most solutions I’ve found so far have recommended replacing the WooCommerce breadcrumbs with the ones provided by Yoast. If you’ve done any customization or styling based on the WooCommerce breadcrumbs, the Yoast SEO version is less than ideal. The HTML structure of the Yoast breadcrumbs is a series of nested <span> tags and the divider is manually set through the plugin settings. Not only is this not great from a CSS styling perspective, it’s completely differnent from the breadcrumb structure provided by WooCommerce and other breadcrumbs plugins.
Another option that exists for integrating the Primary Category in to the WooCommerce breadcrumbs is to simply override the main term that WooCommerce uses to generate the crumbs. The code below demonstrates how to do this using the `woocommerce_breadcrumb_main_term` filter. This code can be added to your theme’s functions.php file or in a plugin file: