Skip to content

Conversation

@hannakebedom
Copy link
Contributor

@hannakebedom hannakebedom commented May 12, 2025

Problem

While working on https://github.com/Shopify/shopify-dev/pull/57187, I noticed that the bundles price per component example didn't have a rust version. I had to write one for https://github.com/Shopify/shopify-dev/pull/57187 so I'm including it here as well!

Solution

This PR adds a new Cart Transform example called "Cart Transform" that demonstrates how to implement bundle expansion functionality. The example shows how to:

  1. Detect when a bundle product is added to the cart
  2. Read bundle configuration from product metafields
  3. Expand the bundle into its individual components as separate line items
  4. Apply the correct pricing to each component

The example includes an implementation in Rust. It handles currency conversion by adjusting prices according to the presentment currency rate.

@hannakebedom hannakebedom changed the title add price per component rust example Add bundle price per component rust example May 12, 2025
@hannakebedom hannakebedom marked this pull request as ready for review May 12, 2025 21:09
@tanusrixh
Copy link

LGTM! Although I'm now wondering if we should include rust examples for all the cart transform function examples that don't have rust versions...

@hannakebedom hannakebedom merged commit f8796bc into main May 14, 2025
4 checks passed
@hannakebedom hannakebedom deleted the 05-12-add_price_per_component_rust_example branch May 14, 2025 14:02
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.

3 participants