Add checkbox to wordpress woocommerce product page - wordpress

I have woocommerce store in my wordperss site.
What I want is I want to add checkbox box to my product page in front side.
How can I do this??
Need Your help.
Thanks.

Not sure if this is the best way but I guess you could something along the lines of this..
Add the checkbox in single-product\add-to-cart\simple.php inside the form and then add_action('init', 'check_for_checkbox_value_here'); and inside the init hook you can store that checkbox value in the session and then check on checkout page for that session value.
Then on action woocommerce_checkout_update_order_meta you can save that value in the database for future reference or any backend functionalities you may be having.
Hope that helps!

Related

Product field in WordPress form changes when adding a new field?

I am very new to WordPress and I am trying to edit a registration form by adding more fields. When I add a new text field, the product field no longer displays the product and price and just shows the default. I didn't make the website I just need to edit this, I am using the Gravity Forms plugin.
This is the form before editing:
And after adding a new field the product field ( in green writing) reverts to default values:
I can't figure out what makes it change so if you have come across this problem before or have any advice please let me know. Thanks!
I'd bet there is some custom code at play here is that is dependent on the field ID. When you change the field, it has a new ID, and the custom code isn't being applied. I'd suggest doing a full theme/plugin conflict (start with your theme) to see where that custom code resides:
https://docs.gravityforms.com/testing-for-a-themeplugin-conflict/

Customizing Woocoomerce Cart page

Hi I want to add checkbox on my Cart page of woocommerce when user check the box it will automatically subscribe them for my product. I have bought woocommerce subcriber plugin but I don't know how to add checkbox which will have this functionality in cart page.
I will try to answer to the best of my knowledge given that I am not proficient with woocommerce. But the general idea is that, you add your checkbox on the cart page of the theme and pass the the value via form data(like name="subscribe" value="True/false") to the data handler(most probably the next page in the checkout cycle which would be delivery or payment options page), which will then call the plugin and pass the subscriber info to it. I would say that it would make sense to put the checkbox where you collect customer info but hey your site, your choice.
Sorry if this is a very generic answer and not a detailed one. I am very new to this myself. Best of luck.

Add New Input Field in Wordpress Post Entry

I am hoping someone can help with this.
I am a Wordpress newbie, and I have heard about how great Wordpress nowadays.
I have a quick question, how do I add or modify the Post form entry so that I can add more input fields like drop down, checkboxes, or radio buttons to the Post form page.
Any guidance or references that I can look into will be greatly appreciated.
you can use custom post field for plugin for this purpose
download this Here after that you can fetch the input field with
get_post_meta($post->ID,'field name');

WooCommerce - no confirmation after adding product to cart

I'm not sure it's meant to be like this, but when I click the 'Add to cart' button on a product (when viewing a page of products), no visual confirmation is given to the user.
Am I missing a JS file? Or maybe I need a div with a specific ID in my HTML for the message to be displayed in? Or do I need to create my own JS callback method to handle when the product has been added?
I've researched this, and there's surprisingly little info on it (so maybe I broke something?).
I have WC's "Enable AJAX add to cart buttons on product archives" option ticked, and I can confirm that products are actually being added to the cart - the user just doesn't know anything about it!
Thanks in advance.
Problem solved - I had unticked WC's "Enable WooCommerce CSS styles". It should come with a warning in my opinion! :)

custom page in Drupal

hi i have created a website in drupal.In this registration page can be access by following url
http://mysite.com?q=user/register
But i want to make a custom page for registration.
Please give me some guide line , i don't have any idea for this
You want to modify the user registration form,
http://www.google.ca/search?client=safari&rls=en&q=user+registration+template+drupal&ie=UTF-8&oe=UTF-8&redir_esc=&ei=Jn0dTdTzI466sQP4uZ2PCg
a) hook_form_user_register_alter() documentation at http://api.drupal.org/api/drupal/developer--hooks--core.php/function/hook_form_alter/6 b) if you totally cant do what you want with a happy little form altering then you can always hook_menu_alter() the page and use whatever page callback you desire instead of drupal_get_form.
Goto admin/build/modules
Enable Profile module
Add fields in profile and while adding a field make it 'visible during registration'

Resources