Wrong approach for custom product page?

My needs seem fairly straightforward but the solution I’m coming up with seems fairly convoluted which leads me to believe that I may be on the wrong path and I’d appreciate your input.

Requirements:
I have a store in which I’m selling 5 products that all require the following information:

  • quantity
  • cross streets for delivery
  • name of person who sold the product

I was attempting to make the ‘name of person’ a drop down to eliminate error. We had tried using the “product options” but the number of names is greater than allowed for that. Instead, I created a dataset with the names and tied it to a dropdown box. I also created a dynamic page, added in all of my required elements, and created a custom ‘add to cart’ button since the prepackaged one doesn’t seem to get *this from the page (rather it must be tied to a specific product).
This is where I have run into an issue. The API docs seems to indicate that #page.getProduct() is the way to get obtain the Product ID that I would use in addToCart(), but the forums explain that .getProduct() doesn’t work on dynamic store pages. There are examples in the forums of similar requests for reviews, but I’m not attempting to do a repeatable review, just an “add to cart”.

I also attempted to simply modify the stock product page, but I don’t see the ability to use my custom drop-down as the input source for the name of person who sold the product.

Is there an obvious answer that I’m just not seeing?

Hello.

It’s true that the getProduct can only be used on the inbuilt Wix Store product page.

You can pass product IDs to the addToCart function as shown in this example: Add to Cart Gallery

To build dropdown options from a database follow the loadContinents function example here .

Good luck!

I’m new, and I know this a year out, but I think that you are on the right track. I’m still building my site, but I have a custom product page that configures way more than 300 possible variants for custom-printed garments, so part of how I set it up can apply to your situation.
Rather than tie your ‘names’ to the product options, assign the value to a text variable on the onchange() event. Then when the product is added to the cart, manually put the salesperson name in as custom text.

Psuedo Code for getting name of salesperson:
var mytext;

$w(‘#dropdown’).onChange(() => {
mytext=$w('#dropdown).value;
}

Psuedo Code for add to cart:

$w(‘#shoppingCartIcon’).addToCart(ProductID, myqty, {
“customTextFields”: [ {
“title”: “Salesperson”,
“value”: mytext,
}] }
)