Setting and populating hardcoded GA custom dimensions in Shopify

Hi! I’m trying to tag my Shopify site for Google Ads dynamic remarketing via a custom dynamic ad feed (as opposed to via a Merchant Center feed, for which there are a lot of apps).

I need to set two GA custom dimensions (dynx_itemid and dynx_pagetype), which I would normally do via GTM in my GA tag settings and tag my product pages with a datalayer script like so:

In Shopify, as you know GA + Enhanced Ecommerce is set up via a built-in integration. I cannot tag my checkout flow manually, so using GTM is not an option in this use case.

So in my case, I would need to set these 2 custom dimensions and populate them with appropriate values manually. The script I’ve ended up using is as follows:

This script doesn’t seem to work, as my custom dimensions don’t show up in my pageview hits.
What am I missing here? Does anyone have experience with setting up custom GA dimensions manually in Shopify and populating those dimensions? I would be forever grateful if anyone could help me out with this.