How to use a metafield as the price of a product

Hello,

I need to have the price of a product be equal to a metafield.

Is this possible via script editor or otherwise?

Notes:

The metafield is a unique numeric value, and the metafield is associated with the customer account.

The metafield is not a discount, and the product will not have a price without the metafield (the price is always the metafield amount).

Thanks in advance for any information.

The Script Editor currently doesn’t support metafields so won’t be something you could use to set the price of a product. Even if it did, the metafield could only be used to discount a product vs setting a price. Shopify Scripts reduces the price - it doesn’t increase. It’s an important distinction.

A product in Shopify will always have a price, even if that price is 0.

I’m not sure of why you want this but it’s possible that Draft Orders are the approach you will need to take. If you have a few more details on why you need it could reveal other options.

Hi Jason,

Thanks for your response.

I think we are going to move away from this solution, but the original idea was the following (if anyone else looks for similar):

We need the customer invoices from a back office system payable online. These are orders placed outside of Shopify/POS.

I had thought we might populate a Customer Metafield with the invoice total. When the customer added a product (named “Invoice”) to their cart, the price would reflect the metafield total. They would then pay the invoice via Shopify by buying the “invoice” product.

If it could be done, it would work as a simple invoice payment solution, but tracking and reporting is very limited.

Thanks again.