Cart Transform Function API, Usage Scenario

I want to implement a feature where buying product A automatically adds product B to the cart. However, when I tried to achieve “buy 2A get 1B free,” it simply didn’t work. Later, I realized that for scenarios like “buy N A get 1B” or “buy 2C,” this function is completely unusable.

(Note: The translation maintains the technical context while adjusting phrasing for natural English flow. “buy NA send 1B,2C” is interpreted as shorthand for quantity-based promotions, hence rendered as “buy N A get 1B or buy 2C.”)

The Cart Transform Function API is mainly for bundling. For other scenarios, you’re better off using a combination of the AJAX Cart API (for adding/removing items) and separate discounts.