Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[VNDA] Feat: create addItems action #889

Merged
merged 1 commit into from
Oct 1, 2024
Merged

Conversation

yuriassuncx
Copy link
Contributor

Pull Request: Add Bulk Item Addition to Cart Action

Summary

This PR introduces a new action that allows for bulk addition of items to the cart, enhancing performance and user experience. This feature is especially useful for "Buy Together" functionalities commonly utilized in e-commerce platforms.

Changes Made

  • Created an asynchronous action function that accepts a list of items to be added to the cart.
  • Implemented error handling for missing cart cookies, returning a 400 HTTP error if the cookie is absent.
  • Enhanced the payload structure to match the OpenAPI standards for bulk item addition, as specified in the VNDA documentation: VNDA API Documentation.
  • Introduced a new loader to optimize the retrieval of cart data after items are added.

Key Points

  • Input: The action takes a Props object containing an array of items, each with an itemId, quantity, and optional attributes.
  • Output: Returns the updated cart state after the items have been added.
  • Compliance: Followed the VNDA API documentation to ensure compatibility and correctness.

Rationale for Loader Creation

The introduction of the loader is crucial for implementing the "Buy Together" feature effectively. This loader is designed to:

image

  • Improve Performance: It optimizes the retrieval process for cart data, ensuring faster responses and a smoother user experience.
  • Suitability for Use Case: It aligns perfectly with scenarios where multiple items are added at once, making the data fetching more efficient and tailored to the needs of e-commerce applications.

Testing

  • Please ensure to test the action with various scenarios, including:
    • Adding multiple items successfully.
    • Handling of missing cart cookies.
    • Correct formatting of item attributes.

Additional Notes

This implementation not only enhances the user experience by allowing bulk operations but also prepares the application for more advanced e-commerce features in the future.

Copy link
Contributor

Tagging Options

Should a new tag be published when this PR is merged?

  • 👍 for Patch 0.59.17 update
  • 🎉 for Minor 0.60.0 update
  • 🚀 for Major 1.0.0 update

@guitavano guitavano merged commit c6fcf17 into deco-cx:main Oct 1, 2024
3 checks passed
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.

2 participants