Skip to content

Wiki createDiscount function missing isLimitedToProducts option #136

@felixranesberger

Description

@felixranesberger

Hi! I just created a discount using the wiki page: https://github.com/lmsqueezy/lemonsqueezy.js/wiki/Discounts#usage

I found that the discount was not limited to certain products, as the variantIds configuration option would suggest.
When adding isLimitedToProducts: true it works fine.
It should probably be also listed in the example, since most users would expect the coupon to be limited, when variantIds are provided.

Current

const { statusCode, error, data } = await createDiscount({
	name: 'TestDiscount',
	amount: 50,
	amountType: 'percent',
	storeId: 123456,
	variantIds: [345678, 456789],
});

Proposed

const { statusCode, error, data } = await createDiscount({
	name: 'TestDiscount',
	amount: 50,
	amountType: 'percent',
	storeId: 123456,
	variantIds: [345678, 456789],
	isLimitedToProducts: true,
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions