DSTNC Docs
  • Integrations
    • Shopify
    • Magento
    • WooCommerce
    • Wix (beta)
    • OpenCart
    • Squarespace
    • Shipstation
    • PrestaShop
    • CSV / Google Sheets
  • Brand Portal
    • Orders
      • Overview
      • Order details
      • Fulfill orders
      • Manually fulfill order
      • Fulfill part of an order manually
      • Fulfill multiple orders at the same time
      • Sorting unfulfilled orders
    • Payments
      • Supported Countries
      • Connect to Stripe
      • Getting Paid
      • How often you get paid
      • View Invoices
      • View Paid Invoices
      • Export Unpaid Invoices
      • Export Paid Invoices
      • View Payments
      • Export Payments
  • Returns
    • Page 1
Powered by GitBook
On this page
  • Getting started
  • Syncing Wix
  • Troubleshooting Errors
  • Multilingual
  1. Integrations

Wix (beta)

In this article, we describe how to integrate with Wix. DSTNC can automatically import catalogs requiring no more than a few steps.

PreviousWooCommerceNextOpenCart

Last updated 2 years ago

Please note:

This is a partial integration. Order sync is currently not available with Wix.

Getting started

With DSTNC, you can publish and automatically sync products between your Wix store and DSTNC. Tracking details can be entered through the , as Wix doesn't currently allow orders to be synced.

Syncing Wix

To enable the inventory feed sync, you will need to do the following:

  1. Click on Edit Site from the main Wix dashboard menu.

  2. In the editor, turn on Dev mode by clicking it on the top bar.

  3. On the left side menu, click on the plus sign next to Backend > New js. File.

  4. Next, rename the new file to “http-functions.js”❗️If the file already exists, we recommend co-tagging a developer to ensure your current setup continues to operate as expected, as the file contents will need to be copied into the existing file.

  5. Copy paste the following code to the editor and, click save, and then publish.

import { notFound, ok, serverError } from 'wix-http-functions';
import wixData from 'wix-data';
import wixStores from 'wix-stores-backend';

export async function get_productsListing({ query }) {
    const options = {
        headers: {
            'Content-Type': 'application/json',
        },
    };

    const products = [];
    // Always get 100 items from first page i.e. skip 0, if query parameters are not set
    let [page, limit] = [0, 100];

    if (query) {
        page = query.page ? parseInt(query.page, 10) : page;
        limit = query.limit ? parseInt(query.limit, 10) : limit;
    }

    try {
        const result = await wixData.query('Stores/Products')
            .include('inventoryItem', 'variant')
            .skip(page * limit)
            .limit(limit)
            .find();

        for (const item of result.items) {
            // eslint-disable-next-line no-underscore-dangle
            item.mappedVariants = await wixStores.getProductVariants(item._id, {});
            products.push(item);
        }
    } catch (onRejected) {
        options.body = {
            error: onRejected.message,
        };
        return serverError(options);
    }

    options.body = {
        items: products,
        query,
    }
    return ok(options);
}
  1. The last step is to turn off Dev mode and hit publish again.

Troubleshooting Errors

There are two main mistakes that we often see as the cause for a failed Wix feed on DSTNC. If your Wix feed is not fetching products or is giving an error, please verify the following:

  1. Ensure that the URL entered is correct. It should either be in the format of https://.wixsite.com// or https:///

  2. Ensure there is no Wix example code included in the file. Wix can sometimes include example code in the functions file. It should look like this:

import {ok, badRequest} from 'wix-http-functions';

export function get_example(request) {
const response = {
"headers": {
"Content-Type": "application/json"
}
};

// Get operation from the request path
const operation = request.path[0]; // "multiply"
const leftOperand = parseInt(request.query["leftOperand"], 10); // 3
const rightOperand = parseInt(request.query["rightOperand"], 10); // 4


// Perform the requested operation and return an OK response
// with the answer in the response body

switch (operation) {
case 'add':
response.body = {
"sum": leftOperand + rightOperand
};
return ok(response);
case 'multiply':
response.body = {
"product": leftOperand * rightOperand
};
return ok(response);
default:
// If the requested operation was not found, return a Bad Request
// response with an error message in the response body
response.body = {
"error": "unknown operation"
};
return badRequest(response);
}
}

If so, this may need to be removed for the feed to work. If you're unsure about the nature of the code embedded in the file, we recommend checking with a Wix developer to make you don't delete the wrong piece of code.

If you have ensured all of the above, and the feed is still not loading as expected, kindly take screenshots of your backend, and forward them to support@dstnc.com.

Multilingual

Ensure the file is named correctly. If it is not correctly named, DSTNC is unable to access the product data from the store. If https://.wixsite.com//, you should be able to access: https://.wixsite.com//_functions/productsListing If https:///, you should be able to access:

Brands using Wix can use translation tools provided by Wix for automated or manual translation into other languages, aside from your base language (). Unfortunately, the translated content is currently not available when syncing products. As such, only the base language is available on the platform.

https:///_functions/productListing
https://support.wix.com/en/article/wix-multilingual-an-overview