@liquidcommerce/elements-sdk 2.7.1 → 2.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/index.checkout.esm.js +6788 -6890
- package/dist/index.esm.js +10440 -10643
- package/dist/ssr-stub.checkout.esm.js +18 -0
- package/dist/ssr-stub.esm.js +270 -0
- package/dist/types/auto-initialize/shared-utils.d.ts +3 -1
- package/dist/types/clients/base.d.ts +6 -4
- package/dist/types/clients/builder.d.ts +2 -1
- package/dist/types/clients/checkout.d.ts +2 -10
- package/dist/types/clients/main.d.ts +2 -1
- package/dist/types/constants/core.constant.d.ts +0 -5
- package/dist/types/core/api/api-client.service.d.ts +16 -15
- package/dist/types/core/api/api-result.d.ts +19 -0
- package/dist/types/core/api/auth-client.service.d.ts +13 -5
- package/dist/types/core/base-component.service.d.ts +2 -1
- package/dist/types/core/client/client-action.service.d.ts +1 -1
- package/dist/types/core/client/client-config.service.d.ts +1 -1
- package/dist/types/core/pubsub/pubsub.service.d.ts +0 -2
- package/dist/types/core/singleton-manager.service.d.ts +12 -8
- package/dist/types/core/store/interfaces/core.interface.d.ts +7 -11
- package/dist/types/core/store/interfaces/product-list.interface.d.ts +12 -28
- package/dist/types/core/store/store.service.d.ts +1 -0
- package/dist/types/core/telemetry/telemetry.service.d.ts +1 -0
- package/dist/types/enums/core.enum.d.ts +5 -4
- package/dist/types/index.checkout.d.ts +3 -2
- package/dist/types/index.checkout.umd.d.ts +1 -1
- package/dist/types/index.d.ts +4 -1
- package/dist/types/interfaces/client.interface.d.ts +72 -0
- package/dist/types/interfaces/component.interface.d.ts +7 -0
- package/dist/types/interfaces/config.interface.d.ts +46 -0
- package/dist/types/interfaces/configs/address.interface.d.ts +1 -1
- package/dist/types/interfaces/configs/cart.interface.d.ts +1 -1
- package/dist/types/interfaces/configs/checkout.interface.d.ts +1 -1
- package/dist/types/interfaces/configs/global.interface.d.ts +1 -1
- package/dist/types/interfaces/configs/product-list.interface.d.ts +1 -1
- package/dist/types/interfaces/configs/product.interface.d.ts +1 -1
- package/dist/types/interfaces/injection.interface.d.ts +44 -0
- package/dist/types/modules/address/address-input.component.d.ts +0 -11
- package/dist/types/modules/address/address.command.d.ts +1 -1
- package/dist/types/modules/checkout/components/checkout-completed.component.d.ts +1 -0
- package/dist/types/modules/checkout/components/checkout-stripe-form.component.d.ts +2 -1
- package/dist/types/modules/product/components/product-image-carousel.component.d.ts +3 -0
- package/dist/types/modules/product/components/product-retailers-carousel.component.d.ts +3 -0
- package/dist/types/modules/product/components/product-retailers-popup-list.component.d.ts +3 -2
- package/dist/types/modules/product/product.commands.d.ts +1 -3
- package/dist/types/modules/product-list/components/card-components/index.d.ts +0 -2
- package/dist/types/modules/product-list/components/card-components/product-badge.d.ts +1 -0
- package/dist/types/modules/product-list/components/card-components/product-sizes-list.d.ts +9 -3
- package/dist/types/modules/product-list/components/index.d.ts +1 -1
- package/dist/types/modules/product-list/components/product-list-engraving.component.d.ts +2 -5
- package/dist/types/modules/product-list/components/product-list-filters.component.d.ts +3 -3
- package/dist/types/modules/product-list/components/product-list-product-engraving-lines.component.d.ts +21 -0
- package/dist/types/modules/product-list/components/product-list-product-pre-cart.component.d.ts +30 -14
- package/dist/types/modules/product-list/components/product-list-search.component.d.ts +0 -2
- package/dist/types/modules/product-list/product-list-card.component.d.ts +18 -16
- package/dist/types/modules/product-list/product-list-filter.utils.d.ts +8 -0
- package/dist/types/modules/product-list/product-list.commands.d.ts +7 -54
- package/dist/types/modules/product-list/product-list.component.d.ts +2 -11
- package/dist/types/modules/product-list/product-list.interface.d.ts +0 -30
- package/dist/types/modules/ui-components/drawer/drawer.component.d.ts +1 -0
- package/dist/types/modules/ui-components/engraving/engraving-form.component.d.ts +1 -10
- package/dist/types/modules/ui-components/engraving/engraving-view.component.d.ts +4 -1
- package/dist/types/modules/ui-components/lce-element/lce-element.component.d.ts +2 -1
- package/dist/types/modules/ui-components/promo-code-ticker/promo-code-ticker.component.d.ts +1 -1
- package/dist/types/modules/ui-components/ui.commands.d.ts +6 -4
- package/dist/types/ssr/stub.checkout.d.ts +6 -0
- package/dist/types/ssr/stub.d.ts +10 -0
- package/dist/types/utils/dom-compat.d.ts +2 -0
- package/dist/types/utils/product-selection.d.ts +16 -0
- package/dist/types/utils/product.d.ts +10 -0
- package/docs/v1/README.md +2 -2
- package/docs/v1/api/actions/address-actions.md +11 -11
- package/docs/v1/api/actions/cart-actions.md +13 -13
- package/docs/v1/api/actions/checkout-actions.md +23 -23
- package/docs/v1/api/actions/product-actions.md +6 -6
- package/docs/v1/api/client.md +11 -11
- package/docs/v1/api/ui-helpers.md +11 -11
- package/docs/v1/examples/advanced-patterns.md +1 -1
- package/docs/v1/examples/checkout-flow.md +1 -1
- package/docs/v1/getting-started/concepts.md +7 -7
- package/docs/v1/getting-started/installation.md +2 -2
- package/docs/v1/getting-started/quick-start.md +3 -3
- package/docs/v1/guides/address-component.md +11 -11
- package/docs/v1/guides/best-practices.md +14 -14
- package/docs/v1/guides/cart-component.md +23 -23
- package/docs/v1/guides/checkout-component.md +24 -24
- package/docs/v1/guides/events.md +812 -77
- package/docs/v1/guides/product-component.md +5 -5
- package/docs/v1/integration/nextjs.md +11 -2
- package/docs/v1/integration/react.md +3 -3
- package/docs/v1/integration/vanilla-js.md +1 -1
- package/docs/v1/integration/vue.md +24 -0
- package/docs/v1/reference/browser-support.md +9 -0
- package/docs/v1/reference/error-handling.md +2 -2
- package/docs/v1/reference/troubleshooting.md +10 -2
- package/package.json +17 -13
- package/dist/types/interfaces/core.interface.d.ts +0 -139
- package/dist/types/modules/product-list/components/card-components/product-fulfillments.d.ts +0 -12
- package/dist/types/modules/product-list/components/card-components/product-title.d.ts +0 -6
- package/dist/types/modules/product-list/components/product-list-retailers.component.d.ts +0 -26
- package/dist/types/modules/ui-components/modal/modal.component.d.ts +0 -23
- package/dist/types/modules/ui-components/styles/modal.style.d.ts +0 -1
- package/docs/gitbook/actions.md +0 -160
- package/docs/gitbook/address.md +0 -48
- package/docs/gitbook/cart.md +0 -65
- package/docs/gitbook/checkout.md +0 -131
- package/docs/gitbook/events.md +0 -137
- package/docs/gitbook/overview.md +0 -166
- package/docs/gitbook/product.md +0 -64
- package/docs/gitbook/quick-start-guide.md +0 -393
|
@@ -21,26 +21,26 @@ await Elements('KEY', { env: 'production' });
|
|
|
21
21
|
|
|
22
22
|
### Use Global Access
|
|
23
23
|
|
|
24
|
-
After initialization, use `window.elements`:
|
|
24
|
+
After initialization, use `window.LiquidCommerce.elements`:
|
|
25
25
|
|
|
26
26
|
```javascript
|
|
27
27
|
// Initialize once
|
|
28
28
|
await Elements('KEY', { env: 'production' });
|
|
29
29
|
|
|
30
30
|
// Use globally throughout your app
|
|
31
|
-
window.elements.actions.cart.openCart();
|
|
31
|
+
window.LiquidCommerce.elements.actions.cart.openCart();
|
|
32
32
|
```
|
|
33
33
|
|
|
34
34
|
### Wait for Client Ready
|
|
35
35
|
|
|
36
36
|
```javascript
|
|
37
|
-
if (window.elements) {
|
|
37
|
+
if (window.LiquidCommerce.elements) {
|
|
38
38
|
// Client already ready
|
|
39
|
-
window.elements.actions.cart.openCart();
|
|
39
|
+
window.LiquidCommerce.elements.actions.cart.openCart();
|
|
40
40
|
} else {
|
|
41
41
|
// Wait for initialization
|
|
42
42
|
window.addEventListener('lce:actions.client_ready', () => {
|
|
43
|
-
window.elements.actions.cart.openCart();
|
|
43
|
+
window.LiquidCommerce.elements.actions.cart.openCart();
|
|
44
44
|
});
|
|
45
45
|
}
|
|
46
46
|
```
|
|
@@ -83,7 +83,7 @@ await client.injectProductElement([...]);
|
|
|
83
83
|
|
|
84
84
|
```javascript
|
|
85
85
|
try {
|
|
86
|
-
await window.elements.actions.cart.addProduct([...]);
|
|
86
|
+
await window.LiquidCommerce.elements.actions.cart.addProduct([...]);
|
|
87
87
|
} catch (error) {
|
|
88
88
|
if (error.name === 'SDKError') {
|
|
89
89
|
console.error('SDK Error:', error);
|
|
@@ -158,7 +158,7 @@ setTimeout(async () => {
|
|
|
158
158
|
```javascript
|
|
159
159
|
// Set address if known
|
|
160
160
|
if (userSavedAddress) {
|
|
161
|
-
await window.elements.actions.address.setAddressManually(
|
|
161
|
+
await window.LiquidCommerce.elements.actions.address.setAddressManually(
|
|
162
162
|
userSavedAddress,
|
|
163
163
|
userCoordinates
|
|
164
164
|
);
|
|
@@ -167,7 +167,7 @@ if (userSavedAddress) {
|
|
|
167
167
|
// Pre-fill checkout info
|
|
168
168
|
window.addEventListener('lce:actions.checkout_opened', () => {
|
|
169
169
|
if (userIsLoggedIn) {
|
|
170
|
-
window.elements.actions.checkout.updateCustomerInfo({
|
|
170
|
+
window.LiquidCommerce.elements.actions.checkout.updateCustomerInfo({
|
|
171
171
|
firstName: user.firstName,
|
|
172
172
|
email: user.email
|
|
173
173
|
});
|
|
@@ -183,7 +183,7 @@ Cart persists across sessions - avoid clearing unless intentional:
|
|
|
183
183
|
// Only clear when user explicitly requests
|
|
184
184
|
document.getElementById('clear-cart-btn').addEventListener('click', async () => {
|
|
185
185
|
if (confirm('Clear cart?')) {
|
|
186
|
-
await window.elements.actions.cart.resetCart();
|
|
186
|
+
await window.LiquidCommerce.elements.actions.cart.resetCart();
|
|
187
187
|
}
|
|
188
188
|
});
|
|
189
189
|
```
|
|
@@ -195,7 +195,7 @@ document.getElementById('clear-cart-btn').addEventListener('click', async () =>
|
|
|
195
195
|
```javascript
|
|
196
196
|
// Update UI when cart changes
|
|
197
197
|
window.addEventListener('lce:actions.cart_updated', () => {
|
|
198
|
-
const cart = window.elements.actions.cart.getDetails();
|
|
198
|
+
const cart = window.LiquidCommerce.elements.actions.cart.getDetails();
|
|
199
199
|
updateHeaderCartCount(cart.itemsCount);
|
|
200
200
|
});
|
|
201
201
|
```
|
|
@@ -267,11 +267,11 @@ const client = await Elements('YOUR_API_KEY', {
|
|
|
267
267
|
```javascript
|
|
268
268
|
// Test empty cart
|
|
269
269
|
if (isDevelopment) {
|
|
270
|
-
await window.elements.actions.cart.resetCart();
|
|
270
|
+
await window.LiquidCommerce.elements.actions.cart.resetCart();
|
|
271
271
|
}
|
|
272
272
|
|
|
273
273
|
// Test with specific product
|
|
274
|
-
await window.elements.actions.cart.addProduct([
|
|
274
|
+
await window.LiquidCommerce.elements.actions.cart.addProduct([
|
|
275
275
|
{ identifier: testProductId, fulfillmentType: 'shipping', quantity: 1 }
|
|
276
276
|
]);
|
|
277
277
|
```
|
|
@@ -311,9 +311,9 @@ await window.elements.actions.cart.addProduct([
|
|
|
311
311
|
|
|
312
312
|
```javascript
|
|
313
313
|
if (window.innerWidth < 768) {
|
|
314
|
-
window.elements.ui.floatingCartButton(true);
|
|
314
|
+
window.LiquidCommerce.elements.ui.floatingCartButton(true);
|
|
315
315
|
} else {
|
|
316
|
-
window.elements.ui.cartButton('header-cart', true);
|
|
316
|
+
window.LiquidCommerce.elements.ui.cartButton('header-cart', true);
|
|
317
317
|
}
|
|
318
318
|
```
|
|
319
319
|
|
|
@@ -113,13 +113,13 @@ Create cart buttons using JavaScript:
|
|
|
113
113
|
|
|
114
114
|
```javascript
|
|
115
115
|
// Button in a container
|
|
116
|
-
window.elements.ui.cartButton('my-container', false); // No badge
|
|
116
|
+
window.LiquidCommerce.elements.ui.cartButton('my-container', false); // No badge
|
|
117
117
|
|
|
118
118
|
// Button with item count
|
|
119
|
-
window.elements.ui.cartButton('my-container', true); // With badge
|
|
119
|
+
window.LiquidCommerce.elements.ui.cartButton('my-container', true); // With badge
|
|
120
120
|
|
|
121
121
|
// Floating button
|
|
122
|
-
window.elements.ui.floatingCartButton(true); // With badge
|
|
122
|
+
window.LiquidCommerce.elements.ui.floatingCartButton(true); // With badge
|
|
123
123
|
```
|
|
124
124
|
|
|
125
125
|
### Custom Toggle Buttons
|
|
@@ -139,19 +139,19 @@ The SDK automatically adds click handlers to elements with `data-lce-cart-toggle
|
|
|
139
139
|
### Open Cart
|
|
140
140
|
|
|
141
141
|
```javascript
|
|
142
|
-
window.elements.actions.cart.openCart();
|
|
142
|
+
window.LiquidCommerce.elements.actions.cart.openCart();
|
|
143
143
|
```
|
|
144
144
|
|
|
145
145
|
### Close Cart
|
|
146
146
|
|
|
147
147
|
```javascript
|
|
148
|
-
window.elements.actions.cart.closeCart();
|
|
148
|
+
window.LiquidCommerce.elements.actions.cart.closeCart();
|
|
149
149
|
```
|
|
150
150
|
|
|
151
151
|
### Toggle Cart
|
|
152
152
|
|
|
153
153
|
```javascript
|
|
154
|
-
window.elements.actions.cart.toggleCart();
|
|
154
|
+
window.LiquidCommerce.elements.actions.cart.toggleCart();
|
|
155
155
|
```
|
|
156
156
|
|
|
157
157
|
### Add Product to Cart
|
|
@@ -159,7 +159,7 @@ window.elements.actions.cart.toggleCart();
|
|
|
159
159
|
Add products programmatically:
|
|
160
160
|
|
|
161
161
|
```javascript
|
|
162
|
-
await window.elements.actions.cart.addProduct([
|
|
162
|
+
await window.LiquidCommerce.elements.actions.cart.addProduct([
|
|
163
163
|
{
|
|
164
164
|
identifier: '00619947000020',
|
|
165
165
|
fulfillmentType: 'shipping', // or 'onDemand'
|
|
@@ -182,7 +182,7 @@ await window.elements.actions.cart.addProduct([
|
|
|
182
182
|
### Apply Promo Code
|
|
183
183
|
|
|
184
184
|
```javascript
|
|
185
|
-
await window.elements.actions.cart.applyPromoCode('SUMMER20');
|
|
185
|
+
await window.LiquidCommerce.elements.actions.cart.applyPromoCode('SUMMER20');
|
|
186
186
|
```
|
|
187
187
|
|
|
188
188
|
The SDK automatically:
|
|
@@ -194,7 +194,7 @@ The SDK automatically:
|
|
|
194
194
|
### Remove Promo Code
|
|
195
195
|
|
|
196
196
|
```javascript
|
|
197
|
-
await window.elements.actions.cart.removePromoCode();
|
|
197
|
+
await window.LiquidCommerce.elements.actions.cart.removePromoCode();
|
|
198
198
|
```
|
|
199
199
|
|
|
200
200
|
### Reset Cart
|
|
@@ -202,7 +202,7 @@ await window.elements.actions.cart.removePromoCode();
|
|
|
202
202
|
Clear all items from the cart:
|
|
203
203
|
|
|
204
204
|
```javascript
|
|
205
|
-
await window.elements.actions.cart.resetCart();
|
|
205
|
+
await window.LiquidCommerce.elements.actions.cart.resetCart();
|
|
206
206
|
```
|
|
207
207
|
|
|
208
208
|
### Get Cart Details
|
|
@@ -210,7 +210,7 @@ await window.elements.actions.cart.resetCart();
|
|
|
210
210
|
Retrieve current cart information:
|
|
211
211
|
|
|
212
212
|
```javascript
|
|
213
|
-
const cartData = window.elements.actions.cart.getDetails();
|
|
213
|
+
const cartData = window.LiquidCommerce.elements.actions.cart.getDetails();
|
|
214
214
|
|
|
215
215
|
console.log(cartData);
|
|
216
216
|
// {
|
|
@@ -239,7 +239,7 @@ Show cart subtotal anywhere on your page:
|
|
|
239
239
|
|
|
240
240
|
<script>
|
|
241
241
|
window.addEventListener('lce:actions.client_ready', () => {
|
|
242
|
-
window.elements.ui.cartSubtotal('cart-total');
|
|
242
|
+
window.LiquidCommerce.elements.ui.cartSubtotal('cart-total');
|
|
243
243
|
});
|
|
244
244
|
</script>
|
|
245
245
|
```
|
|
@@ -257,7 +257,7 @@ Show the number of items in the cart:
|
|
|
257
257
|
|
|
258
258
|
<script>
|
|
259
259
|
window.addEventListener('lce:actions.client_ready', () => {
|
|
260
|
-
window.elements.ui.cartItemsCount('items-count', {
|
|
260
|
+
window.LiquidCommerce.elements.ui.cartItemsCount('items-count', {
|
|
261
261
|
hideZero: true // Hide when cart is empty
|
|
262
262
|
});
|
|
263
263
|
});
|
|
@@ -425,7 +425,7 @@ When you update the cart in one tab, all other open tabs automatically sync:
|
|
|
425
425
|
|
|
426
426
|
```javascript
|
|
427
427
|
// Tab 1: Add item
|
|
428
|
-
await window.elements.actions.cart.addProduct([...]);
|
|
428
|
+
await window.LiquidCommerce.elements.actions.cart.addProduct([...]);
|
|
429
429
|
|
|
430
430
|
// Tab 2: Cart automatically updates
|
|
431
431
|
// No additional code needed
|
|
@@ -459,10 +459,10 @@ If no address is set when adding to cart, the SDK:
|
|
|
459
459
|
Set address before adding to cart:
|
|
460
460
|
|
|
461
461
|
```javascript
|
|
462
|
-
await window.elements.actions.address.setAddressByPlacesId('ChIJ...');
|
|
462
|
+
await window.LiquidCommerce.elements.actions.address.setAddressByPlacesId('ChIJ...');
|
|
463
463
|
|
|
464
464
|
// Now add to cart
|
|
465
|
-
await window.elements.actions.cart.addProduct([...]);
|
|
465
|
+
await window.LiquidCommerce.elements.actions.cart.addProduct([...]);
|
|
466
466
|
```
|
|
467
467
|
|
|
468
468
|
## Promo Codes
|
|
@@ -627,8 +627,8 @@ const params = new URLSearchParams(window.location.search);
|
|
|
627
627
|
const campaign = params.get('campaign');
|
|
628
628
|
|
|
629
629
|
if (campaign === 'summer-sale') {
|
|
630
|
-
await window.elements.actions.cart.applyPromoCode('SUMMER20');
|
|
631
|
-
window.elements.actions.cart.openCart();
|
|
630
|
+
await window.LiquidCommerce.elements.actions.cart.applyPromoCode('SUMMER20');
|
|
631
|
+
window.LiquidCommerce.elements.actions.cart.openCart();
|
|
632
632
|
}
|
|
633
633
|
```
|
|
634
634
|
|
|
@@ -658,7 +658,7 @@ Pre-load cart on page load for faster access:
|
|
|
658
658
|
```javascript
|
|
659
659
|
window.addEventListener('lce:actions.client_ready', () => {
|
|
660
660
|
// Cart loads automatically, but you can pre-fetch if needed
|
|
661
|
-
window.elements.actions.cart.getDetails();
|
|
661
|
+
window.LiquidCommerce.elements.actions.cart.getDetails();
|
|
662
662
|
});
|
|
663
663
|
```
|
|
664
664
|
|
|
@@ -673,7 +673,7 @@ async function addToCart(productId) {
|
|
|
673
673
|
button.textContent = 'Adding...';
|
|
674
674
|
|
|
675
675
|
try {
|
|
676
|
-
await window.elements.actions.cart.addProduct([
|
|
676
|
+
await window.LiquidCommerce.elements.actions.cart.addProduct([
|
|
677
677
|
{ identifier: productId, fulfillmentType: 'shipping', quantity: 1 }
|
|
678
678
|
], true);
|
|
679
679
|
|
|
@@ -709,14 +709,14 @@ window.addEventListener('lce:actions.cart_updated', (event) => {
|
|
|
709
709
|
|
|
710
710
|
### Cart Not Opening
|
|
711
711
|
|
|
712
|
-
1. Check that SDK is initialized: `console.log(window.elements)`
|
|
712
|
+
1. Check that SDK is initialized: `console.log(window.LiquidCommerce.elements)`
|
|
713
713
|
2. Verify no JavaScript errors in console
|
|
714
714
|
3. Ensure cart button is properly configured
|
|
715
|
-
4. Try manually: `window.elements.actions.cart.openCart()`
|
|
715
|
+
4. Try manually: `window.LiquidCommerce.elements.actions.cart.openCart()`
|
|
716
716
|
|
|
717
717
|
### Items Not Adding
|
|
718
718
|
|
|
719
|
-
1. Check that address is set: `window.elements.actions.address.getDetails()`
|
|
719
|
+
1. Check that address is set: `window.LiquidCommerce.elements.actions.address.getDetails()`
|
|
720
720
|
2. Verify product identifier is valid
|
|
721
721
|
3. Check fulfillment type is available for the product
|
|
722
722
|
4. Look for errors in browser console
|
|
@@ -90,19 +90,19 @@ The `{token}` placeholder is replaced with the checkout token.
|
|
|
90
90
|
### Open Checkout
|
|
91
91
|
|
|
92
92
|
```javascript
|
|
93
|
-
window.elements.actions.checkout.openCheckout();
|
|
93
|
+
window.LiquidCommerce.elements.actions.checkout.openCheckout();
|
|
94
94
|
```
|
|
95
95
|
|
|
96
96
|
### Close Checkout
|
|
97
97
|
|
|
98
98
|
```javascript
|
|
99
|
-
window.elements.actions.checkout.closeCheckout();
|
|
99
|
+
window.LiquidCommerce.elements.actions.checkout.closeCheckout();
|
|
100
100
|
```
|
|
101
101
|
|
|
102
102
|
### Toggle Checkout
|
|
103
103
|
|
|
104
104
|
```javascript
|
|
105
|
-
window.elements.actions.checkout.toggleCheckout();
|
|
105
|
+
window.LiquidCommerce.elements.actions.checkout.toggleCheckout();
|
|
106
106
|
```
|
|
107
107
|
|
|
108
108
|
### Exit Checkout
|
|
@@ -110,7 +110,7 @@ window.elements.actions.checkout.toggleCheckout();
|
|
|
110
110
|
Navigate away from checkout (requires `exitUrl` configuration):
|
|
111
111
|
|
|
112
112
|
```javascript
|
|
113
|
-
window.elements.actions.checkout.exitCheckout();
|
|
113
|
+
window.LiquidCommerce.elements.actions.checkout.exitCheckout();
|
|
114
114
|
```
|
|
115
115
|
|
|
116
116
|
Configure exit URL:
|
|
@@ -130,7 +130,7 @@ customTheme: {
|
|
|
130
130
|
Skip the cart and go directly to checkout:
|
|
131
131
|
|
|
132
132
|
```javascript
|
|
133
|
-
await window.elements.actions.checkout.addProduct([
|
|
133
|
+
await window.LiquidCommerce.elements.actions.checkout.addProduct([
|
|
134
134
|
{
|
|
135
135
|
identifier: '00619947000020',
|
|
136
136
|
fulfillmentType: 'shipping',
|
|
@@ -142,25 +142,25 @@ await window.elements.actions.checkout.addProduct([
|
|
|
142
142
|
### Apply Promo Code
|
|
143
143
|
|
|
144
144
|
```javascript
|
|
145
|
-
await window.elements.actions.checkout.applyPromoCode('WELCOME10');
|
|
145
|
+
await window.LiquidCommerce.elements.actions.checkout.applyPromoCode('WELCOME10');
|
|
146
146
|
```
|
|
147
147
|
|
|
148
148
|
### Remove Promo Code
|
|
149
149
|
|
|
150
150
|
```javascript
|
|
151
|
-
await window.elements.actions.checkout.removePromoCode();
|
|
151
|
+
await window.LiquidCommerce.elements.actions.checkout.removePromoCode();
|
|
152
152
|
```
|
|
153
153
|
|
|
154
154
|
### Apply Gift Card
|
|
155
155
|
|
|
156
156
|
```javascript
|
|
157
|
-
await window.elements.actions.checkout.applyGiftCard('GIFT-1234-5678');
|
|
157
|
+
await window.LiquidCommerce.elements.actions.checkout.applyGiftCard('GIFT-1234-5678');
|
|
158
158
|
```
|
|
159
159
|
|
|
160
160
|
### Remove Gift Card
|
|
161
161
|
|
|
162
162
|
```javascript
|
|
163
|
-
await window.elements.actions.checkout.removeGiftCard('GIFT-1234-5678');
|
|
163
|
+
await window.LiquidCommerce.elements.actions.checkout.removeGiftCard('GIFT-1234-5678');
|
|
164
164
|
```
|
|
165
165
|
|
|
166
166
|
### Toggle Gift Mode
|
|
@@ -169,33 +169,33 @@ Enable/disable "Send as Gift" mode:
|
|
|
169
169
|
|
|
170
170
|
```javascript
|
|
171
171
|
// Enable gift mode
|
|
172
|
-
await window.elements.actions.checkout.toggleIsGift(true);
|
|
172
|
+
await window.LiquidCommerce.elements.actions.checkout.toggleIsGift(true);
|
|
173
173
|
|
|
174
174
|
// Disable gift mode
|
|
175
|
-
await window.elements.actions.checkout.toggleIsGift(false);
|
|
175
|
+
await window.LiquidCommerce.elements.actions.checkout.toggleIsGift(false);
|
|
176
176
|
|
|
177
177
|
// Toggle current state
|
|
178
|
-
await window.elements.actions.checkout.toggleIsGift();
|
|
178
|
+
await window.LiquidCommerce.elements.actions.checkout.toggleIsGift();
|
|
179
179
|
```
|
|
180
180
|
|
|
181
181
|
### Toggle Billing Same As Shipping
|
|
182
182
|
|
|
183
183
|
```javascript
|
|
184
184
|
// Use shipping address for billing
|
|
185
|
-
await window.elements.actions.checkout.toggleBillingSameAsShipping(true);
|
|
185
|
+
await window.LiquidCommerce.elements.actions.checkout.toggleBillingSameAsShipping(true);
|
|
186
186
|
|
|
187
187
|
// Use different billing address
|
|
188
|
-
await window.elements.actions.checkout.toggleBillingSameAsShipping(false);
|
|
188
|
+
await window.LiquidCommerce.elements.actions.checkout.toggleBillingSameAsShipping(false);
|
|
189
189
|
```
|
|
190
190
|
|
|
191
191
|
### Toggle Marketing Preferences
|
|
192
192
|
|
|
193
193
|
```javascript
|
|
194
194
|
// Opt into email marketing
|
|
195
|
-
await window.elements.actions.checkout.toggleMarketingPreferences('canEmail', true);
|
|
195
|
+
await window.LiquidCommerce.elements.actions.checkout.toggleMarketingPreferences('canEmail', true);
|
|
196
196
|
|
|
197
197
|
// Opt into SMS marketing
|
|
198
|
-
await window.elements.actions.checkout.toggleMarketingPreferences('canSms', true);
|
|
198
|
+
await window.LiquidCommerce.elements.actions.checkout.toggleMarketingPreferences('canSms', true);
|
|
199
199
|
```
|
|
200
200
|
|
|
201
201
|
### Update Customer Information
|
|
@@ -203,7 +203,7 @@ await window.elements.actions.checkout.toggleMarketingPreferences('canSms', true
|
|
|
203
203
|
Pre-fill customer information:
|
|
204
204
|
|
|
205
205
|
```javascript
|
|
206
|
-
window.elements.actions.checkout.updateCustomerInfo({
|
|
206
|
+
window.LiquidCommerce.elements.actions.checkout.updateCustomerInfo({
|
|
207
207
|
firstName: 'John',
|
|
208
208
|
lastName: 'Doe',
|
|
209
209
|
email: 'john@example.com',
|
|
@@ -225,7 +225,7 @@ window.elements.actions.checkout.updateCustomerInfo({
|
|
|
225
225
|
Pre-fill gift recipient information:
|
|
226
226
|
|
|
227
227
|
```javascript
|
|
228
|
-
window.elements.actions.checkout.updateGiftInfo({
|
|
228
|
+
window.LiquidCommerce.elements.actions.checkout.updateGiftInfo({
|
|
229
229
|
firstName: 'Jane',
|
|
230
230
|
lastName: 'Smith',
|
|
231
231
|
email: 'jane@example.com',
|
|
@@ -246,7 +246,7 @@ window.elements.actions.checkout.updateGiftInfo({
|
|
|
246
246
|
Pre-fill billing address:
|
|
247
247
|
|
|
248
248
|
```javascript
|
|
249
|
-
window.elements.actions.checkout.updateBillingInfo({
|
|
249
|
+
window.LiquidCommerce.elements.actions.checkout.updateBillingInfo({
|
|
250
250
|
firstName: 'John',
|
|
251
251
|
lastName: 'Doe',
|
|
252
252
|
email: 'john@example.com',
|
|
@@ -268,7 +268,7 @@ window.elements.actions.checkout.updateBillingInfo({
|
|
|
268
268
|
### Get Checkout Details
|
|
269
269
|
|
|
270
270
|
```javascript
|
|
271
|
-
const checkoutData = window.elements.actions.checkout.getDetails();
|
|
271
|
+
const checkoutData = window.LiquidCommerce.elements.actions.checkout.getDetails();
|
|
272
272
|
|
|
273
273
|
console.log(checkoutData);
|
|
274
274
|
// {
|
|
@@ -532,7 +532,7 @@ If you have customer data, pre-fill it:
|
|
|
532
532
|
// After user logs in
|
|
533
533
|
if (userIsLoggedIn) {
|
|
534
534
|
window.addEventListener('lce:actions.checkout_opened', () => {
|
|
535
|
-
window.elements.actions.checkout.updateCustomerInfo({
|
|
535
|
+
window.LiquidCommerce.elements.actions.checkout.updateCustomerInfo({
|
|
536
536
|
firstName: currentUser.firstName,
|
|
537
537
|
lastName: currentUser.lastName,
|
|
538
538
|
email: currentUser.email,
|
|
@@ -637,10 +637,10 @@ checkout: {
|
|
|
637
637
|
|
|
638
638
|
### Checkout Not Opening
|
|
639
639
|
|
|
640
|
-
1. Verify cart has items: `window.elements.actions.cart.getDetails()`
|
|
640
|
+
1. Verify cart has items: `window.LiquidCommerce.elements.actions.cart.getDetails()`
|
|
641
641
|
2. Check for JavaScript errors in console
|
|
642
|
-
3. Ensure SDK is initialized: `window.elements`
|
|
643
|
-
4. Try manually: `window.elements.actions.checkout.openCheckout()`
|
|
642
|
+
3. Ensure SDK is initialized: `window.LiquidCommerce.elements`
|
|
643
|
+
4. Try manually: `window.LiquidCommerce.elements.actions.checkout.openCheckout()`
|
|
644
644
|
|
|
645
645
|
### Payment Form Not Loading
|
|
646
646
|
|