Will the products be on your store or 100% custom?
You can use WC()->cart->add_to_cart() directly and add custom details, but you may need a dummy product for these to link to. Price can be set on the cart item. This will require PHP knowledge to implement.
All of the products in the store will be custom.
How should I setup the dummy product?
I have PHP knowledge to do this.
The function that Mike was referring to is documented here: https://docs.woothemes.com/wc-apidocs/class-WC_Cart.html#_add_to_cart
And I believe what he meant by a dummy product was creating a product through the admin area that you’re able to pass all of the data to. The product just needs to exist so you can pass it’s ID to the function.
I see in the admin area that you can create different “types” of products, “Simple product”, “Grouped product”, “External/Affiliate product”, “Variable product”. I would assume that the dummy product I need to create is going to be an “External/Affiliate” product.
I see the add_to_cart() method has variation and cart_item_data attributes that will accept an array.
Looking at cart_item_data, I believe this is the array I would like to populate. I am just not sure what the indexes need to be for adding the data? Is that documented somewhere?
Thank you very much.
The dummy product would be simple so it is purchasable. Once added to cart, you can adjust it’s price and set meta data on the cart item. Basic example of adding data https://github.com/mikejolley/woocommerce-product-gift-wrap/blob/master/woocommerce-product-gift-wrap.php#L76-L81