# Shopify Door Configurator (Saved Configs + HubSpot + PandaDoc + Stripe Payment) check

This repository contains a Shopify theme customization for a **door product configurator**, including:

- **Dynamic door options** rendered from product metafields/metaobjects
- **Estimated pricing** updates client-side
- **Saved configurations** (persisted via an external API)
- **HubSpot Integrations** (creates a deal via an external endpoint)
- **New Customer Accounts** login redirect that returns customers to the same product URL and restores selections
- **Pandadoc Integrations** integrated pandadoc contract generate and templates,signature ,drawings
- **Stripe Payment** Generate Link and mManage from Hubspot integrated pandadoc contract generate and templates,signature ,drawings

## How it works (high level)

### Configurator UI (Liquid)

- The configurator markup is output by the snippet:

- Options schema is embedded as JSON in the page and read by JavaScript.

### Configurator logic (JavaScript)


- Responsibilities:
  - Render dynamic option controls from schema JSON
  - Compute estimated price
  - Save/update configurations via an external API
  - Submit HubSpot “Request a Callback”
  - Persist selections to local Storage for post-login restore

## Saved configurations (external API)

The theme expects a backend service that supports saved configuration CRUD.

### Endpoints used

In `assets/door-config.js`, the base URL is currently hardcoded:

- `apiBase`: `https://vd-shopify.youngsoft.in`

And it calls:

- **Folders (collections)**
  - `GET ${apiBase}/api/folders.php?email=...`
- **Configurations**
  - `POST/PUT ${apiBase}/api/configurations.php`
  - `GET ${apiBase}/api/configurations.php?id=...&email=...`

If you are deploying your own backend, update the `apiBase` value accordingly.

## HubSpot “Request a Callback”

The theme calls a backend endpoint that should create a HubSpot deal (or whichever HubSpot object you prefer).

### Endpoint used

In `assets/door-config.js`:

- `POST ${apiBase}/hubspot/api/hubspot-create-deal.php`

The request body is JSON and includes customer email plus the selected door options.

## New Customer Accounts login redirect (return to same product)

When a logged-out customer clicks **“Log in to save”**:

1. The script saves the current selections into `localStorage` under:
2. The customer is sent through Shopify’s New Customer Accounts flow using:
3. After OTP login (or account creation), Shopify redirects back to the same product URL
4. The script detects  restores the saved options, and continues the “save configuration” flow.


Shopify reference: [Shopify Themes](https://shopify.dev/docs/storefronts/themes/login)

## Theme Check

This theme follows Shopify Theme Check naming conventions (snake_case) for Liquid variables.

Reference: [Theme Check VariableName](https://shopify.dev/docs/storefronts/themes/tools/theme-check/checks/variable-name)

## License

See [`LICENSE`](LICENSE).

