How to display field or field value on custom pages?

There are some built-in functions available to print any input field (where possible) or field value in any place of your site.
 
Displaying the fields
 
For eaxmple, wccf_print_product_field() - that can be used to print any product field like that:
<?php wccf_print_product_field(array('key' => 'UNIQUE_FIELD_KEY')); ?>
 Of course UNIQUE_FIELD_KEY there should be replaced with the actual unique key.
 
Or alternatively wccf_print_product_fields() prints multiple product fields - just pass multiple keys in array for parameter.
 
Similarly there are wccf_print_user_field() / wccf_print_user_fields() and wccf_print_checkout_field() / wccf_print_checkout_fields().
 
Note that there's no such functions for product properties and order fields since they are not supposed to be displayed in the frontend.
 
Displaying the values
 
Same settings and usage as above for these functions:
  • wccf_print_product_field_value()
  • wccf_print_product_field_values()
  • wccf_print_product_prop_value()
  • wccf_print_product_prop_values()
  • wccf_print_checkout_field_value()
  • wccf_print_checkout_field_values()
  • wccf_print_order_field_value()
  • wccf_print_order_field_values()
  • wccf_print_user_field_value()
  • wccf_print_user_field_values()

Example of usage with Product ID:

Displaying product property field value of some specific product id:

<?php wccf_print_product_prop_value(array('key' => 'UNIQUE_FIELD_KEY', 'item_id' => 'PRODUCT_ID')); ?>

 

 
Have more questions? Submit a request