function facebook_pixel_data_Purchase in Facebook Pixel 7
Provides additional details for the Facebook Pixel Purchase tag.
Parameters
int $order_id: ID of the order to return additional Purchase tag details for.
Return value
string JSON string containing additional Purchase tag details.
See also
facebook_pixel_commerce_checkout_complete()
File
- ./
facebook_pixel.module, line 196 - Drupal Module: Facebook Pixel.
Code
function facebook_pixel_data_Purchase($order_id) {
$order_wrapper = entity_metadata_wrapper('commerce_order', $order_id);
$order_total = $order_wrapper->commerce_order_total
->value();
$data = array(
'value' => number_format(commerce_currency_amount_to_decimal($order_total['amount'], $order_total['currency_code']), 2, '.', ''),
'currency' => $order_total['currency_code'],
);
return $data;
}