I have a need to create an advanced product with various discounts and conditional statements. I have tried several plugins including Gravity Forms Product Add Ons and various others but they dont seem to do what I need them to.
My need is I want to have a form the user fills out and I can handle all conditionals and when they hit the Add to cart button it will add their order to cart. I could use create order but not sure because it needs a product ID and I am kind of creating the product on the fly for each customer. I could also create the product as this thread suggests then add to cart but I fear if I manually create a product for each customer that we will have an absurd amount of products.
What would be the best way to create a form and then once filled out and submitted the total and details are sent to cart?
This link was a good resource but doesnt go into detail about the product id or how to do the form. Any guidance on the best way to tackle this?
UPDATE:
Here is a wireframe of what I want to do demonstrating the dynamic text boxes and discount rules. The deposits I am using the Woocommerce Deposits plugin. Just not sure the best way to do this.
Related
I have a custom form that users make various selections before being presented with products they can buy. I need to add some logic that if an input has been selected when the user adds a product to the cart, it will also add an additional product to the cart.
The input is 3 radio check boxes. Somehow I need to hook into the add to cart click and check the page to see if one of the radios has been selected and then add the appropriate product but I'm not sure where to start.
I know I'll need to have an action that runs something like:
WC()->cart->add_to_cart( 'product_id', 'quantity');
But I'm not sure how to hook into the initial add to cart click and how to check for the radios on the page.
Thank you for your help.
Not a lot of information to go off of here, but here is a few useful WooCommerce hooks to give you a starting point/ order of operations. When overriding any native action in WordPress or its plugins. You should use the hooks if available.
Add the radio inputs to the single product before the add to cart is added (hook):
add_action("woocommerce_before_add_to_cart_button", "your_input_render_function_here");
Add the new input data from the radio buttons to the cart item (filter):
add_filter("woocommerce_add_cart_item_data", "your_filter_function_to_capture_data_here");
Capture the data and render in cart (filter):
add_filter("woocommerce_get_item_data", "your_cart_render_function");
Finally, save the newly aquired data to the order (hook):
add_action("woocommerce_checkout_create_order_line_item", "your_function_to_add_to_order")
This is one of many directions you can take, depending on your requirements. I recommend giving it a shot, and if you still have issues return with an example of your code.
I am new to wordpress, just worked on 2 sites and I have new challange! now I have to create custom post types as a product because I already have old system with me. I wanted to convert existing offline course products from core php site to wordpress for that I have to create courses as custom posts because these courses will be in two semesters and they have conditional displays according to date.
So can you please suggest me how my approach should be ( I am thinking of creating custom post use it as product and list it with add to cart button and connect with any available plugin which will handle rest of the checkout process with admin functionalities and then I will build the other things arround it )
Note: Actually I am worried about how to list the products/courses per semester if semester is ended then just list them otherwise list will have add to cart function, how can I add the late fee for registration (if applies) and one time registration fee, also I need to add donation amount separately can this be taken care by anything common.
Thanks and Regards
If you will use the woocommerce then you should import your courses as products (post type).
That will make every course you have as a product then you can update the postmeta of this product to the various values of this product like price
So first step is install woocommerce plugin then loop the courses you have on wp_insert_post.
After that in the same loop you should add post meta for every post you inserted.
I am currently developing an interface that allows you to customize a product. I am implementing on Wordpress, but I need to generate an order after you finish the customization process. So it is necessary that the data is added as a product in the shopping cart WooCommerce. Is that possible? What would be the procedure?
As per your requirements i assume a following scenario
For example you have a site which which sells printed Tshirts.
The flow of this example site is that a user comes selects a tshirt, customizes the tshirt product say by adding Tshirt's color, Image on tshirt and Tshirt's size.
These customization added by the customer at the frontend on product page or cart can be stored in post meta for that order.
So if your case is some what like this then Yes this is possible.
And you can use the following links which will help you to achieve your goal.
How to Add Custom Data to WooCommerce Order
and
Custom WooCommerce Order Meta
Let me know if this solution works for you.
After searching on Google for quite a while I am going crazy.
My question: Can you configure Magento to require a coupon code to buy specific product?
This is for a promotion my employer is running, basically we want to allow specific customers to buy specific product in our Magento store before any of our other customers. Thank you for your suggestions.
A brief idea I can give here.
Create a backend module, which has own db tables to save linking of products ID to specific coupon, multiple coupon or just a check that coupon is required, depending on your case. From this Module you should be able to define such linking of product to coupon.
Since customer apply a coupon code at cart page, so we will let customer add product into cart. Then edit isDisabled method of Mage_Checkout_Block_Onepage_Link class. where you will check if your quote has any product from the product-coupon linking defined in your module and coupon is not applied yet. Similar thing you can should do for Multishipping method if it is enabled in your Magento. So whenever coupon coupon code will be applied page will refresh and button will get enabled.
Same check you will need to put in indexAction of Mage_Checkout_OnepageController.
I am using latest wp and wc and I am trying to add a form field in the frontend single product page where the user will be able to add comments which when the order is done the data will be available under woocommerce -> orders. Have anybody done that or it's not even possible because woocommerce is pretty limited for stuff like this?