Skip to content

Conversation

@nicosomb
Copy link
Contributor

Questions Answers
Description? Add resource for Discount Type, see PrestaShop/PrestaShop#40536
Type? new feature
BC breaks? no
Deprecations? no
Fixed ticket? N/A
Sponsor company PrestaShop SA
How to test? GET http://myshop/admin-api/discount-types should return a json with discount types (see below)

Example of json response

[
	{
		"discountTypeId": 1,
		"type": "free_shipping",
		"names": {
			"en-US": "On free shipping",
			"fr-FR": "On free shipping"
		},
		"descriptions": {
			"en-US": "Discount that provides free shipping to the order",
			"fr-FR": "Discount that provides free shipping to the order"
		},
		"active": true
	},
	{
		"discountTypeId": 2,
		"type": "cart_level",
		"names": {
			"en-US": "On cart amount",
			"fr-FR": "On cart amount"
		},
		"descriptions": {
			"en-US": "Discount applied to cart",
			"fr-FR": "Discount applied to cart"
		},
		"active": true
	},
	{
		"discountTypeId": 3,
		"type": "order_level",
		"names": {
			"en-US": "On total order",
			"fr-FR": "On total order"
		},
		"descriptions": {
			"en-US": "Discount applied to the order",
			"fr-FR": "Discount applied to the order"
		},
		"active": true
	},
	{
		"discountTypeId": 4,
		"type": "product_level",
		"names": {
			"en-US": "On catalog products",
			"fr-FR": "On catalog products"
		},
		"descriptions": {
			"en-US": "Discount applied to specific products",
			"fr-FR": "Discount applied to specific products"
		},
		"active": true
	},
	{
		"discountTypeId": 5,
		"type": "free_gift",
		"names": {
			"en-US": "On free gift",
			"fr-FR": "On free gift"
		},
		"descriptions": {
			"en-US": "Discount that provides a free gift product",
			"fr-FR": "Discount that provides a free gift product"
		},
		"active": true
	}
]

@github-project-automation github-project-automation bot moved this to Ready for review in PR Dashboard Jan 20, 2026
@nicosomb nicosomb linked an issue Jan 20, 2026 that may be closed by this pull request
Copy link
Contributor

@jolelievre jolelievre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some minor things to fix, and the test class in the core's PR should be moved in this module and we're good

@jolelievre
Copy link
Contributor

Ah, and for your next PRs prefer using your fork please

@nicosomb
Copy link
Contributor Author

Ah, and for your next PRs prefer using your fork please

oops, sorry

@ps-jarvis ps-jarvis moved this from Ready for review to Waiting for author in PR Dashboard Jan 21, 2026
@nicosomb nicosomb force-pushed the add-discountType-resource branch 2 times, most recently from 381bdcb to 23587c8 Compare January 22, 2026 14:03
@nicosomb nicosomb force-pushed the add-discountType-resource branch from 23587c8 to 5d4052c Compare January 23, 2026 05:53

$this->assertGreaterThanOrEqual(1, count($discountTypes));

if (count($discountTypes) > 0) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to use explicit asertEquals with complete data (to make sure all fields are present, and no field in missing in the expected data Not necessarily all the types but at least the first one

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Waiting for author

Development

Successfully merging this pull request may close these issues.

Handle type compatibility in the discounts

4 participants