Custom Discount Function Applies as “Product, Order & Shipping” Instead of Just “Product”

I’ve built a custom Shopify Function to apply product-specific discounts using a function extension. It works correctly at the line-item level.

However, when I create a discount using my app, the resulting discount in the Shopify Admin appears with “Types: Product, Order & Shipping” instead of just “Product.” This is problematic because:

  • Even though my function only targets product-level discounts,
  • Shopify’s discount engine treats it as being eligible to override order discounts, since only one discount class is applied per checkout (e.g. product or order or shipping).
  • This results in my product discount canceling out an actual order-level discount, even though they should be stackable under Shopify’s rules. If I make order discounts stackable then people can apply 3 or 4 and get the products for free.

What’s confusing is that I don’t get the option to restrict the discount type during discount creation via my app. I also can’t find any documentation or UI to specify the applicable discount class as only Product.

What I’ve tried:

  • My function uses productDiscountsAdd with selectionStrategy: ProductDiscountSelectionStrategy.Maximum
  • The logic itself only operates on cart.lines
  • I added a UI extension, but the Admin doesn’t prompt for discount class or type selection during the creation flow.

My question:

How can I ensure that a discount created through my app using a function extension is classified strictly as a Productdiscount, so it doesn’t interfere with Order or Shipping discounts?

Thanks in advance for any insights!

Managed to get rid of shipping but cant seem to get rid of orders. Got rid of shipping by removing all references to shipping but there seems to be a few more order references in the generated files do these files matter? as far as Shopify typing my discount?

if it helps here are my toml files:
Function:
api_version = “2025-04”

[[extensions]]
name = “discount”
handle = “discount”
type = “function”

description = “Discount for target product.”

[[extensions.targeting]]
target = “cart.lines.discounts.generate.run”
input_query = “src/cart_lines_discounts_generate_run.graphql”
export = “cart-lines-discounts-generate-run”

[extensions.build]
command = “”
path = “dist/extension.js”

[extensions.ui]
enable_create = true
handle = “discount-ui”

UI:
api_version = “2024-10”

[[extensions]]

name = “t:name”
description = “t:description”
handle = “discount-ui”
type = “ui_extension”

[[extensions.targeting]]
module = “./src/DiscountFunctionSettings.js”

(./src/DiscountFunctionSettings.js)
target = “admin.discount-details.function-settings.render”

most of the online references and Ais seem to think the issue is in the ui code so I have added my ui code too:
import {
FunctionSettings,
Text,
BlockStack,
extension,
} from ‘@shopify/ui-extensions/admin’;

const TARGET = ‘admin.discount-details.function-settings.render’;

export default extension(TARGET, (root) => {
const title = root.createComponent(
Text,
{ size: ‘medium’, emphasis: ‘bold’ },
‘Discount Configuration’
);

const info = root.createComponent(
Text,
{},
‘This discount applies to products only.’ //LIE =, please help make it true
);

const settings = root.createComponent(FunctionSettings, {
discountClass: ‘product’,
});

const stack = root.createComponent(BlockStack, {}, title, info);

settings.append(stack);
root.append(settings);
});