Wordpress - common fields for posts - php

I added a new custom post in Wordpress and named it Products.
In admin menu in Products I have two links - All Products and New Product.
Everything works perfectly, each product has it's own permalink, fields and so on.
Question: What shall I do to have a few editable fields to be common for all products?I mean, I wish to edit a field just a single time in admin and it shall display on all product pages.

Use the Settings API.
There is no built-in way to do it at a custom post type level.
You could also define a secondary custom post type ("All Products Details") and attach it to every Product you create as a custom field on it, but then you also have to implement an automated way of setting defaults for custom fields (Here's a way to do this.).

Related

Dynamically pass a Product ID as the main Product Field on a Gravity Form (Product Add On)

I've got a great form set up to allow the building of a complex product and then add it to the cart (using the GForms Product Add on). All lif this is perfect on the actual Woocommerce product page.
What I'd love to do is have this form embedded on a page and populate the Product ID dynamically, so that the form still picks up the product details and will add the new Item to the cart just as it does on a shop page. Having it on its own page (or on any page of the site) will allow us to offer a larger, focused experience to select all the options.
I've been looking into the code and the docs but I can't seem to make it work. The code references product_id everywhere, but the dynamic field option is name. So is this possible? Thanks!
If the data you are attempting to map is simple then the following snippet plus Gravity Forms default {embed_post} and {custom_field} merge tags can get you there:
https://gravitywiz.com/dynamic-products-via-post-meta/
If your data is more advanced (like mapping product attributes), check out Gravity Form Populate Anything:
https://gravitywiz.com/documentation/gravity-forms-populate-anything/

How to add “Variation” product meta tab to custom product type

I'm developing a theme with WooCommerce.
Wanted to enable "variation" tab for my custom product type but have no idea how to do it.
Here is the sample screenshot for reference:
I don't know myself, but Variable products are set up differently from Simple products. If you've set up your custom product based on either the Simple product model or the Abstract product model, it probably won't account for the changes needed for variations.
Have a look at the Variable product object and see how it differs from a Simple one.

Add Custom filter in wordpress

I have create custom post type and add one meta box for ordering. I have add ordering meta-box too. But now i want to add a filter in post type for show up / show out. when admin click on show up then all the post will showing order wise of the meta box that admin you in meta box. It this possible. Also please see the images so i'll clear for you.
Search working from the product ordering.
Well all the records in the admin section in WP are rendered using Wp_List_Table class, more info you can find here.

woocommerce - custom field in order

I have the need to have a custom field in the admin 'edit order' screen of woocommerce.
This field is admin only and does not need to display on the customer order process.
The business case is that the person processing the orders clicks in to the edit order screen for each order and assigns a custom ID (these are random serial numbers on our products) from a drop down list preferably.
The drop down list will be populated from a database of unassigned ID's - (this is a sql database we already use for our main web app)
My question is, is a custom field in the 'edit order' screen the place to perform this assignment?
the alternative is to write a small .net application and assign the Id's there but I would like to keep the order processing to just woocommerce.
If it is possible what hooks should i look in to.
thank you
If your good with PHP and MySQL, you can write your own filters and hooks for the wordpress backend. It's just like writing app's except everything will be pointed to the backend, woocommerce side.
You can read more about the filters and hooks for Wordpress:
http://codex.wordpress.org/Plugin_API
You can either write your own plugins or add your functions etc. to your theme's function.php files.
Use Woocommerce Custom Admin Order Field Plugin by WooThemes

Hiding a custom option on a product in Magento

I have several hundred products in my Magento store, all of which have a very similar set of custom options. I used one product as a template, and copied its custom options to all of the other products so that all of the products currently have the same set of custom options.
I would like to disable or hide certain custom options for some products in my store without deleting the option completely. Right now, I only have the ability to delete an option for a product entirely. For example, some products cannot currently be ordered in different colors, but they might be later; I'd like to be able to disable the color option rather than delete it and re-add the entire list of colors later.
Does anyone have any similar experience who can provide me with some help with this problem? Thanks, I really appreciate the help!
Using custom options for attributes like "color" is not a correct approach for Magento. Magento has special product type - Configurable product for the catalog structure you're trying to achieve.
Here's benefits you'll get from using configurable product instead of custom options:
Automatic stock management. You won't need to enable-disable your custom options as soon as some physical item is out of stock - Magento will do it for you.
You won't have to copy all custom options to a new product you create. The attribute for the Attribute set this product belongs to will automatically be available for new entries.
You will have ability to filter your products by the color attribute on Category page using Layered Navigation.
Here's the guide how to create configurable product from the official Magento wiki.

Categories