How to add attributes for a Simple Product on Checkout Page? - wordpress

Been trying to figure out how to add attributes... for example the size of a product on the checkout page of woocommerce for wordpress. Seems simple enough, but all searches I do on this point me to how to add custom fields to woocommerce using hooks. But I don't want a custom field. I just want to add in the size attribute for Simple Products on the checkout page only so people are reminded of the size... can someone point me in the right direction please?

You can add attributes from admin side. There is no need to use any hooks for this. In admin side go to products->products and edit the product for which you want to add attribute. There below the product description you will find attributes tab there you can add your custom product attribute.
And you can also create common attribute for all the products from Products->Attributes. Here Add New Attribute and after saving it click on configure terms button to add attribute value

Related

WooCommerce: any way to split or clone the tags mechanism inside each product?

I have some task related to WooCommerce.
I need to create a perfume shop. And the task is to create for each perfume the "Perfume Pyramid".
Each perfume made from Top Notes, Middle Notes and Base Notes.
Inside each product i want to show this notes based on the notes i will select inside admin.
Each note should be clickable. When the user will click on some note, for example "vanilla" the user will redirect to the page with all the products that have "vanilla" note.
This is similar to how tags working. But i really don't know how to split / clone the tags mechanism so i will have 3 fields inside each product that will allow me to choose the notes for Top, Middle and Base.
Also, if it is possible to upload image for each tag so i can show tag as image instead text
Maybe you can suggest another way then using tags mechanism.
Thanks
You create 3 Taxonomy : base note, middle note, top note
Taxonomies are "categories", like Tags. You can link the taxonomy to one or many custom post type. In your case link the taxonomy to the "custom post type" Product created by WooCommerce.

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/

How to add properties to Woocommerce account?

I would like to add some properties to my accounts in woocommerce (ie: eyes color)
In the codex, I've found solutions to add fields into checkout but I do not need these informations in checkout, I want them editable into the account page.
Is there a programmatically solution (or a plugin) ?
You need to create custom user field using update_user_meta function . Please read
https://codex.wordpress.org/Function_Reference/update_user_meta
or read this
https://support.woothemes.com/hc/en-us/articles/203182373-How-to-add-custom-fields-in-user-registration-on-the-My-Account-page

How To Add Custom Field In woo commerce product listing admin page in Wordpress

I am very much new to wordpress and need help. Well I need to add a custom field to woocommerce product listing page in admin and make it work.
So where do I have to make changes in code or in admin section.I need some suggestions on how to make it work.
Thanks in advance
if I'm understanding you right you want to add new fields to your woocommerce products, and you want those fields to show up in the admin panel. I am working on this right now myself and I have found a few good resources.
First of all, although I can't find any documentation on them yet directly in the woocommerce API docs, there are two hooks for extending the admin panel.
woocommerce_product_write_panel_tabs - this allows you to insert a new tab within the admin panel. from browsing the source of various free woocommerce plugins that do this it appears that the tab format should be <li>Tab Name</li>.
woocommerce_product_write_panel - this is where the insertion of your custom panel contents would go, placed within a <div id="#tab_name"></div>
These are the two hooks that I have had a great deal of difficulty locating. They allow you to hook into the actual woocommerce admin area, otherwise custom fields you might add will end up in a separate panel.
For all the details on actually adding the custom fields themselves and hooking them up to the front-end, I suggest this tutorial here, which covers the basic concepts involved in adding a new meta-data field and hooking it into the product display (in this case the single-product detail view, it sounds like you want to modify them in the list view but this will show you the basic principles).
http://www.xatik.com/2013/02/06/add-custom-form-woocommerce-product/
Note: that tutorial doesn't use the woocommerce admin panel but creates its own panel, the instructions I gave above, plus this tutorial, should get you just about anywhere you need to go.

Giving different Post page for same type based on category or Custom Taxonomy

I'm having a site which has option to add hotels and restaurants. Both for them has different custom fields which i have added meta boxes with a plugin. But the custom fields of hotel are not needed for restuarant and vice versa.
So what I want to achieve is create extra menu on admin panel saying Add Restaurant & Add Hotel. When clicked on Hotel its should only show the custom fields configured for Hotel. I know this can be achieved by custom post types. But i don't want another post type unless i have no options.
Figured out that this is not the right place to ask.
Better try codex.

Resources