Skip to content

Conversation

@juanpprieto
Copy link
Contributor

@juanpprieto juanpprieto commented Apr 1, 2025

Add support for multiple discounts via addDiscount including tests.

Closes #1015

@juanpprieto juanpprieto requested review from Copilot and kdaviduik April 1, 2025 17:48
@juanpprieto juanpprieto marked this pull request as ready for review April 1, 2025 17:48
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds support for multiple discount codes by updating the addDiscount functions in both the input mapper and checkout resource, along with corresponding tests. Key changes include reformatting conditional blocks for improved readability, modifying the addDiscount function to accept multiple discount codes, and updating the checkout resource to merge existing and new discount codes.

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
src/input-map-resource.js Reformatted conditionals and updated addDiscount to accept multiple discount codes.
src/checkout-resource.js Refactored addDiscount to merge existing discount codes from different parts of the checkout object and adjusted other method invocations.
.changeset/ten-cooks-clap.md Minor changeset update noting the support for multiple discounts.
Comments suppressed due to low confidence (1)

src/checkout-resource.js:209

  • There is a typo in the variable name 'existtingLineCodes'. Consider renaming it to 'existingLineCodes' for clarity.
const existtingLineCodes = checkout.lineItems.map((lineItem) => {

@juanpprieto
Copy link
Contributor Author

/snapit

1 similar comment
@juanpprieto
Copy link
Contributor Author

/snapit

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Can't add multiple discount codes to checkout v3

1 participant