Set Minimum Order Quantities for different products using Metafields2 App

We are trying to get the “minimum order quantity” working again via metafields2 app. We used this before in our old theme version. When a customer is on the product page the quantity selector should default to whatever the moq value is and nothing less. I wrote the code, but for some reason it is not working. Same code that currently works on old theme version. I will attach the code that I updated with for your review. Right now the updated code has been removed.

I know we can use the metafields that are native on our theme under settings - custom data - product metafields, but we would have touch every product again to input the moq value. We have already set all these up under the Metafields2 App. So, we just need to make the code is reading properly.

Can someone please assist by looking at the code?

Since you already have the MOQ set up via the Metafields2 App, the key is ensuring that the code properly reads from the correct metafield and sets the quantity selector accordingly.

Double-check that the metafield namespace and key in your code match the ones in the Metafields2 App. Also, make sure the JavaScript is correctly targeting the quantity selector and setting the value. If the code worked on your old theme, there may be something related to how your new theme handles JavaScript or how the metafield data is being passed.