Advertisement
sparkweb

Hook to Add Your Keys to Product Array

Sep 4th, 2011
364
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //Add Your Own Keys to the $product array
  2. //This should go in your functions.php file
  3. add_filter('foxyshop_setup_product_info', 'my_product_setup', 10, 2);
  4. function my_product_setup($product_array, $product_id) {
  5.    
  6.     //Do as many of these as you want
  7.     $product_array['my_custom_field'] = get_post_meta($product_id, 'my_custom_field', 1);
  8.    
  9.     //Always return the new, complete array
  10.     return $product_array;
  11. }
Advertisement
RAW Paste Data Copied
Advertisement