How can I dynamically pull SKU and Barcode on PDP pages?

Hi there,

I am trying to get a piece of JS firing on the PDP pages on my site.

For the script to run correctly, it needs to dynamically pull in the current page SKU and/or Barcode.

The code is below, taken from an old site and I’ve highlighted the the piece that needs to change to the Shopify variable object.


would love if there is anyone who may be able to help