/**
 * Retrieve values for a custom purchase field.
 *
 * The parameters must not be considered optional. All of the purchase meta fields
 * will be retrieved and only the meta field key values returned.
 * This meta data function mirrors a corresponding wordpress post meta function.
 *
 * @since 3.8.14
 *
 * @param string $key Meta field key.
 * @param int $purchase_id purchase ID
 * @return array Meta field values.
 */
function wpsc_get_purchase_custom_values($key = '', $purchase_id = 0)
{
    if (!$key) {
        return null;
    }
    $custom = wpsc_get_purchase_custom($purchase_id);
    return isset($custom[$key]) ? $custom[$key] : null;
}
 private function set_meta_props()
 {
     foreach (wpsc_get_purchase_custom($this->get('id')) as $key => $value) {
         $this->meta_data[$key] = wpsc_get_purchase_meta($this->get('id'), $key, true);
     }
     $this->set_total_shipping();
     $this->set_gateway_name();
     $this->set_shipping_method_names();
 }