Home > Blockchain >  Yoast breadcrumbs not displaying correctly on imported WooCommerce products
Yoast breadcrumbs not displaying correctly on imported WooCommerce products

Time:03-25

I am importing products via Product Import Export for WooCommerce by WebToffee, I then have a function which pulls data from an API and populates the data in each imported product.

Everything works perfectly, except Yoast breadcrumbs don't show properly when I view the product. The breadcrumbs on the frontend will say e.g. Shop » Product Name instead of the full category and sub category breadcrumb trail.

The only way I can successfully get the breadcrumbs to show properly is by manually editing the product and clicking update, it then shows correctly, as in:

Shop » Workwear » High Visibility » Hi Vis Polo Shirts & T-Shirts » Product Name

This would be fine, except I will be importing thousands of products in one sitting so I need a programmatic solution to add to my function which will make the breadcrumbs display properly on the frontend.

What I've tried so far

In my function I've tried populating the following custom meta data within each product:

_yoast_wpseo_metadesc
_yoast_wpseo_title
_yoast_wpseo_primary_product_cat
_yoast_wpseo_content_score
_yoast_wpseo_estimated-reading-time-minutes

But unfortunately setting all of the above doesn't seem to affect the display of the breadcrumbs.

I've also tried clearing product transients in wp-admin after import and product creation but this didn't resolve the issue.

Any ideas on how I can get this working? Is there a function I can run as part of the WC-Product object which will trigger the breadcrumbs to sort themselves out as it does when manually clicking Update in edit product?

Any help would be greatly appreciated

CodePudding user response:

Well it really depends how you're importing products. Currently, when each product insert, SEO Yoast meta isn't setting up in database so everytime you need to edit and update that product.

The custom meta might also not worked in your case because you're not inserting data in other Yoast table like _yoast_indexable.

Can you show us how you're importing products so we might help you?

  • Related