I’m having trouble with
I am new to this portion of eCommerce. Meta is asking for: Build parameters to handle products. In your URL, the ID and quantity for each product parameter should be separated by a colon. Commas (%2C) and colons (%3A) are escaped according to RFC 3986.
Working in
Meta and wix.com portal. Not sure I understand what is needed.
Site link
the instructions from Meta. Not to friendly for novices.
What I’m trying to do
I am trying to create a Checkout URL, that will automatically update when I add new items to my catalog, so that users can see these items on FB and IG, and FB and IG will push them to my checkout page.
What I’ve tried so far
I am not very familiar with the additional coding that is needed for this, but I have tried to follow the directions on Meta, Wix and ChatGPT.
Extra context
Screenshots attached.
CHatGPT provided the below, but I have no idea where this coding is supposed to go or how to test:
import { createCheckout } from ‘wix-ecom-backend’;
import wixStoresBackend from ‘wix-stores-backend’;
/**
* Generates a checkout URL with ALL active products in your store.
* Always up to date when products change.
*/
export async function getUniversalCheckoutUrl() {
try {
// Fetch up to 200 products (adjust limit if you have more)
const { products } = await wixStoresBackend.getProducts({ limit: 200 });
if (!products.length) {
throw new Error(“No products found in store.”);
}
// Map each product to a line item
const lineItems = products.map(product => ({
catalogReference: {
appId: ‘1380b703-ce81-ff05-f115-39571d94dfcd’, // Wix Stores App ID
catalogItemId: product._id
},
quantity: 1 // Default quantity; can be adjusted
}));
// Create checkout session
const checkout = await createCheckout({ lineItems });
// Return the checkout URL
return checkout.checkoutUrl;
} catch (err) {
console.error(“Error creating universal checkout URL:”, err);
throw err;
}
}

