Skip to content

breaking: remove deprecated cart API#1240

Open
rmi22186 wants to merge 2 commits intobreaking/remove-deprecated-logcommerce-methodsfrom
breaking/remove-cart-api-v2
Open

breaking: remove deprecated cart API#1240
rmi22186 wants to merge 2 commits intobreaking/remove-deprecated-logcommerce-methodsfrom
breaking/remove-cart-api-v2

Conversation

@rmi22186
Copy link
Copy Markdown
Member

@rmi22186 rmi22186 commented Apr 3, 2026

Summary

  • Removes the long-deprecated cart API (mParticle.eCommerce.Cart.add/remove/clear, Identity.getCurrentUser().getCart(), and all associated methods)
  • Removes ShoppingCart from the SDK event model, server DTO conversion, and Events API converter
  • Removes maxProducts config option and cart-related storage name constants
  • Cleans up all associated interfaces (SDKCart, ICart, SDKShoppingCart, mParticleUserCart)

Breaking Changes

The following public APIs are removed:

  • mParticle.eCommerce.Cart.add(product, logEvent)
  • mParticle.eCommerce.Cart.remove(product, logEvent)
  • mParticle.eCommerce.Cart.clear()
  • mParticle.Identity.getCurrentUser().getCart()
  • mParticle.Identity.getCurrentUser().getCart().add()
  • mParticle.Identity.getCurrentUser().getCart().remove()
  • mParticle.Identity.getCurrentUser().getCart().clear()
  • mParticle.Identity.getCurrentUser().getCart().getCartProducts()
  • maxProducts init config option

Migration: Use mParticle.eCommerce.logProductAction() with mParticle.ProductActionType.AddToCart or mParticle.ProductActionType.RemoveFromCart instead.

Test plan

  • Build passes (npm run build)
  • All 2030 tests pass (npm test)
  • Verify no runtime errors when Cart methods are not present on the eCommerce object

🤖 Generated with Claude Code

rmi22186 and others added 2 commits April 3, 2026 15:35
The cart API has been deprecated for a long time and only logged
deprecation warnings. This removes it entirely.

Removed public APIs:
- mParticle.eCommerce.Cart.add/remove/clear
- mParticle.Identity.getCurrentUser().getCart()
- mParticle.Identity.getCurrentUser().getCart().add/remove/clear/getCartProducts

Also removed:
- SDKCart, ICart, SDKShoppingCart, mParticleUserCart interfaces
- ShoppingCart from SDK event model and server DTO conversion
- convertShoppingCart from events API converter
- NativeSdkPaths for AddToCart/RemoveFromCart/ClearCart
- maxProducts config option
- Cart product storage name constants

Users should use mParticle.eCommerce.logProductAction() with
ProductActionType.AddToCart or ProductActionType.RemoveFromCart instead.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…t code

- Remove buildProductList from ecommerce.js and its interface (no
  remaining callers after logPurchaseEvent/logRefundEvent removal)
- Remove empty "should return an empty array when no cart products
  exist" test that had no assertions
- Remove orphaned product1/checkProduct code in stub tests

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Comment thread src/ecommerce.js
}
};

this.buildProductList = function(event, product) {
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

deadcode from logpurchase/logrefund which were removed

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Apr 3, 2026

@rmi22186 rmi22186 marked this pull request as ready for review April 3, 2026 20:17
@rmi22186 rmi22186 requested a review from a team as a code owner April 3, 2026 20:17
@cursor
Copy link
Copy Markdown

cursor bot commented Apr 3, 2026

PR Summary

Medium Risk
Medium risk because it removes previously exposed (though deprecated) public APIs and stops emitting shopping_cart/sc fields in commerce payloads, which can break downstream integrations expecting them.

Overview
Removes the long-deprecated cart surface area from the SDK: mParticle.eCommerce.Cart.* and Identity.getCurrentUser().getCart() are deleted along with their type definitions, stubs, and instance-manager passthroughs.

Eliminates ShoppingCart from the commerce event model and serialization pipeline (SDK runtime models, server DTO conversion, and Events API conversion), and drops related config/constants such as maxProducts and cart-specific storage names.

Written by Cursor Bugbot for commit 618f07c. This will update automatically on new commits. Configure here.

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