Wix Velo JS issue creating an eCommerce validation service plugin

23 hours ago 4
ARTICLE AD BOX

This is a known issue with Wix's Service Plugin template generator — the interfaces-ecommerce-v1-validations-provider module resolves at runtime on the Wix platform, not in the editor. The warning is cosmetic and won't prevent your code from running.

For your actual goal (blocking checkouts older than 29 minutes), here's the issue: the options.validationInfo object contains line items, shipping, billing, and discounts — but not the checkout creation timestamp. The validation SPI doesn't expose createdDate on the checkout object passed to this function.

You have a couple of options:

Option 1: Store the timestamp yourself

Use a Wix Data collection to record when the checkout started, then check it in the validation:

import * as ecomValidations from 'interfaces-ecommerce-v1-validations-provider'; import wixData from 'wix-data'; export const getValidationViolations = async (options, context) => { const violations = []; const checkoutId = options.validationInfo?.purchaseFlowId; if (checkoutId) { const result = await wixData.query('CheckoutTimestamps') .eq('checkoutId', checkoutId) .find(); if (result.items.length > 0) { const createdAt = new Date(result.items[0].createdAt).getTime(); const minutesElapsed = (Date.now() - createdAt) / 1000 / 60; if (minutesElapsed > 29) { violations.push({ severity: ecomValidations.Severity.ERROR, target: { other: { name: ecomValidations.NameInOther.OTHER_DEFAULT } }, description: 'This checkout session has expired. Please start a new checkout.', }); } } } return { violations }; };

You'd need to populate the CheckoutTimestamps collection when the checkout is created (via the https://dev.wix.com/docs/velo/api-reference/wix-ecom-v2/events/checkout).

Option 2: Use the eCommerce Events API instead

If you don't strictly need to block checkout, you could use the onCheckoutCompleted event to check timing and issue a refund or flag the order after the fact.

Read Entire Article