Sale!

WooCommerce Custom Fields

$35.00 $20.00

Add infinite custom fields in WooCommerce product pages and for each variation.

SKU: 104 Category: Tag:

Description

Plugin creates custom fields in WooCommerce product pages.
Set different field values for each variations.
Add infinite custom fields.

Usage:

In plugin settings enter number of fields to add.

In plugin main menu, enter new field names, submit the new field names and they are available at product pages.

Values entered in Woocommerce product or variations’ custom fields get saved directly in database based on the product id.

Free support is available at https://ziscom.today/contact_us/

============= INTEGRATE PLUGIN WITH YOUR CUSTOM NEEDS ==============


/* Fetch field names and values manually for all Woocommerce custom fields for product and variations in PHP */

                /** mapping field names made in WCF plugin below **/

                $no_of_fields = get_option( 'wcf_no_of_fields'	);
                $field =array();
                for( $x = 1; $x <= $no_of_fields; $x++){
                    $field[] = get_option('wcf_field_name'.$x);
                }

                /** mapping single product custom field values below **/

                $no_of_fields = get_option( 'wcf_no_of_fields'	);
                $value =array();
                for( $x = 1; $x <= $no_of_fields; $x++){
                    $value[] = get_post_meta($id,'_custom_product_text_field'.$x,true);
                }


                /** mapping variations custom field values below **/

                $no_of_fields = get_option( 'wcf_no_of_fields'	);
                $valuev =array();
                for( $x = 1; $x <= $no_of_fields; $x++){
                    $valuev[] = get_post_meta($id,'_custom_variations_product_text_field'.$x,true);
                }

                /** passing the values collected to a multidimensional array **/

                $array = array(
                  $product_id => array(
                    'field_name' => $field,
                    'field_namev' => $field,
                    'field_value' => $value,
                    'field_valuev' => $valuev,
                  ),
                );

                /** displaying custom field names and values entered for each product based on product id **/

                $all_ids = get_posts( array(
                    'post_type' => 'product',
                    'numberposts' => -1,
                    'post_status' => 'publish',
                    'fields' => 'ids',
                ) );
                foreach ( $all_ids as $product_id) {
                    foreach ($array as $key => $value) {
                        print_r($value);   
                   } 
                }
               

Reviews

There are no reviews yet.

Be the first to review “WooCommerce Custom Fields”

Your email address will not be published. Required fields are marked *