addToCurrentCart not working for guest users in 2026 - all APIs deprecated

I’m using Wix Velo in 2026 and need to add a product with specific variant options (Size and Pack) to the cart from a backend .web.js file for guest/visitor users.

I have tried every API available:

  • wix-stores-frontend cart.addToCart → deprecated
  • wix-ecom-frontend cart → crashes
  • wix-ecom-backend currentCart.addToCurrentCart → crashes with “Cannot read property”
  • wix-stores-backend → Cannot find module
  • wix-pay-backend → Cannot find module

The simple version without any imports works fine and redirects to cart but adds the wrong variant.

My product has two options:

  • Size: 2x2 inch Square, 2.5x2.5 inch Square
  • Pack: Single, 5-Pack, 10-Pack, 25-Pack

Question: What is the correct 2026 Velo API to add a specific product variant to cart for a guest user from a backend file?

It’s generally encouraged to use SDKs where possible.

Can you share the code you’re using/have tried? The Cannot find module sounds like a missed import.

"Thank you! Here is the code I have tried. The issue is currentCart from wix-ecom-backend crashes with ‘Cannot read property’ when called from a backend .web.js file for guest/visitor users.

What works (but adds wrong variant):

export async function createMagnetPayment(orderDetails) {
  return {
    success: true,
    cartId: 'added'
  };
}

import { currentCart } from 'wix-ecom-backend';

export async function createMagnetPayment(orderDetails) {
  const { productSize, packSize } = orderDetails;

  try {
    const updatedCart = await currentCart.addToCurrentCart({
      lineItems: [{
        catalogReference: {
          appId: '215238eb-22a5-4c36-9e7b-e7c08025e04e',
          catalogItemId: '0475cc69-da96-a229-903c-48081c5013f9'
        },
        quantity: 1
      }]
    });

    return { success: true };
  } catch (error) {
    return { success: false, error: error.message };
  }
}

Error: Cannot read property — happens for guest/visitor users only.

How do I pass the correct Size and Pack variant so the right price shows in cart?"

If this code is within a web.js file, then for the function to be available/callable from the frontend (which I imagine is what you’re doing), then it’ll need to be wrapped in a webMethod - Web Method | Velo

In regards to the variant, I’d recommend reading this doc - Velo Wix Stores Backend E Commerce Integration | Velo

Based on the docs, you’ll need to pass additional options in the catalogReference as key pairs (the above docs will explain the format needed), so you can give the additional info like size and reference

"Thank you so much! I tried wrapping in webMethod before but got ‘Cannot find module wix-web-module’. Is that the correct import for 2026?

Also for the variant options, should it be formatted like this:

options: {
Size: productSize,
Pack: packSize
}

Or is there a different format needed for Wix Stores variants?"

“I’m using Wix Editor not Wix Studio. Is wix-web-module only available in Wix Studio? What is the correct way to call a backend function for guest users in Wix Editor 2026?”

Hi, I tried the webMethod approach but getting this error:

Cannot find module 'wix-web-module' in 'backend'

Here is exactly what I tried:

import { Permissions, webMethod } from ‘wix-web-module’;
import { currentCart } from ‘wix-ecom-backend’;

export const createMagnetPayment = webMethod(
Permissions.Anyone,
async (orderDetails) => {
const { productSize, packSize } = orderDetails;
try {
const updatedCart = await currentCart.addToCurrentCart({
lineItems: [{
catalogReference: {
appId: ‘215238eb-22a5-4c36-9e7b-e7c08025e04e’,
catalogItemId: ‘0475cc69-da96-a229-903c-48081c5013f9’,
options: {
Size: productSize,
Pack: packSize
}
},
quantity: 1
}]
});
return { success: true };
} catch (error) {
return { success: false, error: error.message };
}
}
);

What is the correct approach for Wix Editor?"