There are certain products that require customization directly on their product page and cannot be added to the cart directly from a widget. In this situation, you have two available choices.
Instructions
Exclude Products
You can exclude those items from being returned by the widget using the data source exclusion filters.
Custom Code Workaround
By incorporating this code into the widget, the buttons will be configured to redirect the user to the product page, rather than adding the item to the cart. Take the code provided below and paste it into the "Advanced" > "Ready" section of the widget. Afterward, remember to click on the "Save" button to preserve the changes.
/* Make widget ATC buttons redirect to product page */
setTimeout(() => {
const items = widget.data.products;
const widgetButtons = document.querySelectorAll(`#rebuy-widget-${widget.id} .rebuy-button`);
widgetButtons.forEach((btn, index) => {
const newBtn = btn.cloneNode(true)
newBtn.addEventListener("click", () => {
window.location.href = items[index].link
})
btn.replaceWith(newBtn)
})
}, 400)
Once you have successfully pasted the given code into the widget's "Advanced" > "Ready" section and saved the changes, the buttons in the widget will be modified. Instead of adding the item to the cart when clicked, they will now redirect the user to the corresponding product page. This way, users can view the product details and customize it as needed before making a purchase.
To complete the process, you need to adjust the language of the widget's button. Follow these steps:
Open the widget settings.
Look for the "Language" tab or section in the widget settings.
Find the option that allows you to change the text for the "Add to Cart" button.
Edit the text to say whatever you prefer, for example, "View Details" or "Customize Now."
Save the changes in the widget settings.
By doing this, the button language will be updated, and it will now display the new text you've set, aligning with the functionality change to redirect users to the product page instead of adding the item directly to the cart.