Configuring Dynamic Product Page Opening from CMS Instead of WIX Collection For Cart Or Minicart in Wix Editor

Question:
How can I set up the opening of a dynamic product page instead of a product page from the WIX collection when clicking on the product icon in the cart?

Product:
Wix Editor

What are you trying to achieve:
I have 10 different CMS , each with an individual dynamic page for displaying products. Each product in the CMS is linked to the corresponding product in the WIX collection (Store - Product). When clicking on the product icon in the cart or mini-cart, it currently opens the product page from the WIX collection, but I want it to open the dynamic product page from my CMS. I’ve tried using Creating a Group Redirect (301), but it didn’t work.

What have you already tried:
I’ve tried using Creating a Group Redirect (301), but it didn’t lead to the desired result.

Additional information:
I am looking for a way to implement the opening of an individual dynamic product page from my CMS when clicking on the product icon in the cart or mini-cart, instead of the product page from the WIX collection. Perhaps there is another method or function I can use to achieve this goal? Any help or recommendations would be greatly appreciated. Thank you!

1 Like

This may work (not tested). Change ID’s to suit elements

import { cart } from 'wix-stores-frontend';
import wixLocation from 'wix-location';

$w.onReady(async function () {
  let currentCart = await cart.getCurrentCart();

  $w('#product-icon').onClick(() => {
    let productId = currentCart.lineItems[0].productId; // replace 0 with the index of the product
    wixLocation.to(`/Product/${productId}`); // replace 'Product' with the actual URL of your dynamic product page
  });
});

Those icons are not codable but you can either create a router or add a redirect code directly on the native product page that forwards visitor to the new dynamic page.

My favorite thing to do is to build directly ON the native Wix product page and adding a filter to display the correct product ( instead of redirecting to another page). This means collapsing the native widget and designing right on the page.

#codequeen

1 Like