Overview
This prompt aims to guide developers in creating a 3D sofa configurator integrated with Shopify, enhancing user experience and functionality. Developers working on similar projects will benefit from structured data flow and user interaction strategies.
Prompt Overview
Purpose: This document outlines a structured approach to building a 3D sofa configurator integrated with Shopify.
Audience: It is intended for developers familiar with NextJS, TypeScript, and React Three Fiber.
Distinctive Feature: The configurator allows dynamic variant retrieval and conditional addon association for a personalized shopping experience.
Outcome: Following this plan will enable a seamless user interaction flow and efficient data management in the application.
Quick Specs
- Media: Text
- Use case: Generation
- Industry: Business Communications, Development Tools & DevOps, Property Development
- Techniques: Decomposition, Plan-Then-Solve, Structured Output
- Models: Claude 3.5 Sonnet, Gemini 2.0 Flash, GPT-4o, Llama 3.1 70B
- Estimated time: 10-20 minutes
- Skill level: Intermediate
Variables to Fill
- [ProductName] – Productname
- [VariantName] – Variantname
- [AddonName] – Addonname
Example Variables Block
- [ProductName]: Linea Sofa
- [VariantName]: Large Size
- [AddonName]: Extra Cushions
The Prompt
You are assisting a developer in building a 3D configurator for an online sofa store integrated with the Shopify Storefront API. The store features three main sofa collections:
– Linea
– Cloud
– Noble
Additionally, there is an Addons collection called Sofa Addons, each containing modular products and variants that influence pricing.
Your task is to provide detailed guidance on structuring the project’s data flow and user interactions to achieve the following functionality:
1. Dynamic Variant Retrieval:
– Retrieve and display the correct variants when a user selects a product variant in the 3D configurator.
2. Conditional Addon Association:
– Associate relevant addons based on selected customizations, utilizing the separate Addons collection and employing line item attributes to record which sofa variants require which addons.
3. Cart Item Representation:
– Combine the user’s current modular customization selections into a coherent cart item representation on the client side before adding it to the cart.
– Include a confirmation modal summarizing the selected sofa variants and any addons.
4. Shopify Variant ID Retrieval:
– Efficiently obtain the unique Shopify variant ID from the selected product and variant titles using a provided JavaScript function example to enable adding the correct variant to the cart.
**Stack Details**:
– NextJS with TypeScript
– React Three Fiber (R3F) for 3D rendering
– Valtio for global state management
– Shopify client for Storefront GraphQL queries
**Provide a step-by-step architectural and implementation plan addressing these points, including**:
– Data Modeling:
– How to model and store product and variant data in Valtio state for quick lookup by variant title.
– Addon Linking Best Practices:
– Best practices for linking addons to specific sofa variants and representing that in the cart line attributes.
– UI/UX Flow Recommendations:
– Recommendations for the confirmation modal that combines various selections.
– Integration Tips:
– Tips for using the given `getVariantIdByTitle` function or improved alternatives within NextJS and TypeScript.
**Output Format**:
– Provide a detailed, structured explanation with clearly numbered steps covering:
– Data architecture
– User interaction flow
– State management strategies
– Code snippets or pseudocode where helpful.
– Illustrate key points with concise examples using placeholders (e.g., [ProductName], [VariantName], [AddonName]) where needed.
– Avoid generalities—focus on concrete solutions to the described challenges.
Screenshot Examples
How to Use This Prompt
- [SOFA_COLLECTIONS]: Main sofa collections available online.
- [SOFA_ADDONS]: Modular products enhancing sofa configurations.
- [VARIANT_RETRIEVAL]: Dynamic fetching of selected product variants.
- [ADDON_ASSOCIATION]: Linking relevant addons to sofa variants.
- [CART_ITEM_REPRESENTATION]: Summarizing selections for cart display.
- [SHOPIFY_VARIANT_ID]: Unique identifier for Shopify product variants.
- [STATE_MANAGEMENT]: Using Valtio for global state handling.
- [CONFIRMATION_MODAL]: UI for summarizing user selections.
Tips for Best Results
- Data Architecture: Structure Valtio state to hold an object with collections for sofas and addons, allowing quick access by variant title. For example, use a structure like { sofas: { Linea: { variants: […] }, Cloud: { variants: […] }, Noble: { variants: […] } }, addons: { [AddonName]: { details: […] } } }.
- User Interaction Flow: Implement a listener for variant selection in the 3D configurator that triggers a function to fetch and display relevant addons based on the selected variant. Ensure that the UI updates dynamically to reflect these changes.
- State Management Strategies: Use Valtio to manage global state for selected variants and addons. Create a cart representation that combines these selections, updating the state whenever a user makes a change, ensuring the UI reflects the current selections.
- Integration Tips: Utilize the `getVariantIdByTitle` function to map user selections to Shopify variant IDs. Ensure this function is called whenever a variant is selected, passing the selected variant title to retrieve the correct ID for cart operations.
FAQ
- How should I model product and variant data in Valtio?
Create a structured state object in Valtio, storing products with nested variants. Use titles as keys for quick access. - What are best practices for linking addons to sofa variants?
Use a mapping object to associate addons with variants. Store this mapping in line item attributes for easy retrieval. - What should the confirmation modal include?
Display selected sofa variants, addons, and a summary of customizations. Ensure clear pricing information is visible. - How can I efficiently retrieve Shopify variant IDs?
Utilize the provided `getVariantIdByTitle` function within your component to fetch IDs based on selected titles dynamically.
Compliance and Best Practices
- Best Practice: Review AI output for accuracy and relevance before use.
- Privacy: Avoid sharing personal, financial, or confidential data in prompts.
- Platform Policy: Your use of AI tools must comply with their terms and your local laws.
Revision History
- Version 1.0 (February 2026): Initial release.


