Personalised product form integration to Wix Store

Hi,

Following my last thread on my custom order https://www.wix.com/code/home/forum/questions-answers/personalised-product-order-form

I have now finalized my custom order form and I do need a bit of guidance if possible in terms of moving forward with integrating it to Wix Store so that one can complete purchase. Should I look to submit all data directly into the Store’s “Products” database or submit the data in a separate database and then integrate it to the Store somehow?
If it’s the former then I would imagine that I can’t add fields in the Wix Store db and therefore should I concatenate all my custom fields in one of the Store’s text fields?
Many thanks in advance for your help!
Regards

Hi,

Here’s what I’m suggesting that you do, I just hope that I fully understand all your use cases.
Let’s start with what you have to understand about stores - You will need to pre-define products via the store manager. A product have a preset price, and the price can be affected by product options that you define on it, and you can have up to 6 product options per product.

In terms of APIs that you need:

  1. Use the stores products collection, specifically within you have the options field with the set of product options you defined.
  2. CartIcon - Velo API Reference - Wix.com - This will allow you to add products to the cart with the relevant product options
  3. https://www.wix.com/code/reference/wix-stores-backend.html#getProductOptionsAvailability - This will allow you to get the the availability and price of a specific variant

So generally speaking, you will need to decide where you want to use a separate product and where you want to use product options. For instance, I think that it makes sense that each model would be a separate product, technology and size would be product options as it affects the price, the accessories would be separate products etc.

Once all the input have been entered, you need to call addToCart for each product you want to add to the cart, setting the appropriate choices for the product options for each one and using customTextField in order to set the textual properties (e.g name on stinger)

I hope this will get you on the right track. Please approach me with any specific questions.

Thanks,
Oded

Hi Oded, many thanks for all this info and help for me to continue on the right track!!

Thanks

Hi,

When I try to just test the addToCart() function I get the following error message:

#shoppingCartIcon1 is the cart icon directly brought from the Store

Can you please help me?

Regards

Hi,

This is indeed an issue on our side that we are working to resolve, but its only affect should be this error showing up in the editor. When you run the code, it should work just fine.

Thanks,
Oded

Hi Oded,

First of all, many thanks for your help.

I tried it out it works. I think I just have two remaining questions:

  1. My custom options help define the cost of the product. I guess I can’t parse the updated cost using this function do you confirm? Does that mean I have to create as many products as there are price possibilities? And then add a logic to select the right product ID with the right cost?
  2. My options help define the colours of the product and I show how it looks to the consumer. I guess here also I am not able to parse the updated “look” of it to the cart?

Here’s the link of my work in progress just in case !

Many thanks

Hi,

Both are possible.
In the backoffice, you can define surcharge for each option selection (e.g Red +2$)
You can also define an image for each selection, with the limitation that you can only do it for a single option (so you can define images for Red, Green, Blue or for X, M, L but not for both).

Then, upon any option selection you can use https://www.wix.com/code/reference/wix-stores-backend.html#getProductOptionsAvailability in order to get the image and price. Notice that the price is only available once all selections are sent.

Thanks,
Oded

Hi Oded,
I’m almost there! Also just went premium :open_mouth:

Just so you know I had encountered a bug with the options since I played with the different choices (adding and removing them), the addToCart function stopped working with one of my choices. I removed them and re-added them and it worked.

I’m facing (I hope) one last issue: the second point I had mentioned above in this thread ( 2. My options help define the colours of the product and I show how it looks to the consumer. I guess here also I am not able to parse the updated “look” of it to the cart? ) is not working for me because I can add a combination of colours to my product - so I show it through a customised page where I can play with the layers of colours: https://mathieujamet.wixsite.com/monsite/copy-of-custom-order-the-turtle

So that leads me to the following issue: can I still parse on the updated “look” into the cart? If not, from a user experience point of view I can still put a product image base which says “Custom board” on it for when it’s in the cart only (that’s acceptable because the client will have already see in the order page how the product looks like), but then the issue I have is that once on the cart, the user can still click on the product photo and then access the “standard” wix store ordered product page. That’s a big issue for me because it erases the previous selection, doesn’t contain the multiple colouring and also a lot of other stuff I want to add as in the text field that the user will be able to select (height, width, thickness, type of logo etc…). Is it possible to make so that photo in the cart is not clickable?

Please let me know if it’s clear or not, I can try to show it in other ways.

Many thanks for your help.

Hi,

So happy you’re making great progress :slight_smile:

For the time being, as you guessed. you can’t make the cart show the custom image.
So yes - you can put some “custom board” image and get away with it. As for it being clickable, I’m so glad we got this feedback from you as we didn’t think about this. I will take this with the product team and we’ll come up with a solution.

In the meantime, you can workaround this by placing this code on the WIX default product page:
import wixLocation from ‘wix-location’;
$w.onReady( function () {
wixLocation.to(“/cart”)
});
This will redirect anyone clicking on the product image back to the cart

Thanks,
Oded

Hi Oded, Thanks a lot, it worked BUT (sorry) I also have “normal” products to sell in the store, some that aren’t customisable. These ones need to be added to cart in a traditional way through the product page. So that means I can just probably add in your code above an IF condition to redirect to cart only for the customizable products.
So from the product page, do you know how can I get the current product name of the current page to add to my IF condition to redirect only if the user clicked on one of these customizable products?
Many thanks!!

Hi,

Please use https://www.wix.com/code/reference/$w.ProductPage.html#getProduct in order to get the details about the product being shown on the product page

Thanks,
Oded

Hi Oded, I don’t know how I missed that…!
I think I am all set !!! just need to figure out how to make all fields mandatory before adding to cart, I’ll look around the documentation to figure it out.

Thank you so much for your help, I’m really excited about completing the site now!

Have a good week end!!

@mathieujamet I am trying to create something similar to what you made for your surfboard company in terms of creating a form that users fill out when adding a product to their cart. Are you able to share your code or pointers on how you did this?

Major thank you ahead of time!