public static function createViewContentEvent()

in integration/FacebookWordpressEasyDigitalDownloads.php [294:316]


  public static function createViewContentEvent($download_id){
    $event_data = FacebookPluginUtils::getLoggedInUserInfo();
    $currency = EDDUtils::getCurrency();
    $download = edd_get_download($download_id);
    $title = $download ? $download->post_title : '';

    if (get_post_meta($download_id, '_variable_pricing', true)) {
      $prices = get_post_meta($download_id, 'edd_variable_prices', true);
      $price = array_shift($prices);
      $value = $price['amount'];
    } else {
      $value = get_post_meta($download_id, 'edd_price', true);
    }
    if (!$value) {
      $value = 0;
    }
    $event_data['content_ids'] = [(string)$download_id];
    $event_data['content_type'] = 'product';
    $event_data['currency'] = $currency;
    $event_data['value'] = floatval($value);
    $event_data['content_name'] = $title;
    return $event_data;
  }