Is there a correct way to bust Shopify cache for crawlers like Semrush?

Short description of issue

Busting Shopify cache for crawlers

Link to Shopify Store

Reproduction steps

After making several updates to the theme through the code editor, the results of Semrush became inconsistent.

Some products showed the liquid changes have taken effect, some pages didn’t. I did confirm that on all of the pages checked - the changes reflect to me, but not to Semrush.

Additional info

Refreshing the page several times sometimes helps, sometimes doesn’t. I get the same issue even after 45 minutes.

Any feedback would be appreciated!

What type of topic is this

General discussion

@elilip Shopify does not expose a public cache purge API for merchants of partners.
You can not programmatically force a full CDN flush the way you could on Cludflare or a self-hosted setup.
Semrush’s crawler hits URLs on its own schedule and often gets the stale cached version.
One of the approach is to force the cache invalidation per URL.
Here is the useful Shopify API for that.

PUT /admin/api/2024-01/themes/{theme_id}/assets.json
{
  "asset": {
    "key": "templates/product.liquid",
    "value": "<!-- cache bust --> ..."
  }
}