Applying Discount Percentage from Property Meta to Specific Line Items for Logged-in Users with Cert

Topic summary

Goal: Apply a product-specific discount percentage from a product metafield (“product_discount_percent”) to the corresponding cart line item, but only for logged‑in customers who have a specific tag.

Context: Metafield = custom product field storing the discount percent. Line item = an individual cart entry.

Attempt: Used Shopify Product Discount Functions (GraphQL). Issue: the function applies one discount value across multiple targets, not a per‑item percentage based on each product’s metafield.

What’s needed: A conditional, per‑line‑item discount that reads each product’s metafield and applies it only when the customer is authenticated and tagged.

References: Shopify Functions product-discounts docs link provided.

Status: No solution identified yet; requester is seeking guidance/workarounds. Open/Unresolved.

Summarized with AI on January 17. AI used: gpt-5.

Hello Shopify Community,

I have a metafield named “product_discount_percent” associated with my products, containing the discount percentage. Now, I am facing an issue where I need to apply this discount specifically to line items when a user is logged in and has a certain tag.

To elaborate further, I want to create a conditional scenario where if a user is logged in and has a particular tag, the discount percentage stored in the “product_discount_percent” metafield should be applied to the corresponding line item during checkout.

I have looked into the documentation and various forums but couldn’t find a clear solution for this specific use case.

I tried to achieve this using shopify product discount function but facing issue it always applying discount with multiple targets but single discount value.
https://shopify.dev/docs/api/functions/reference/product-discounts/graphql

Thank you in advance for your help!