Skip to content

Commit ed1b18c

Browse files
committed
Fix missing value of product price
1 parent 094b692 commit ed1b18c

5 files changed

Lines changed: 11 additions & 13 deletions

File tree

includes/integrations/class-integration-custom.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,11 @@ function process_order_markdown( $code, $order_id ) {
120120
$customer = $order->get_user();
121121
$used_coupons = $order->get_used_coupons() ? implode( ',', $order->get_used_coupons() ) : '';
122122
$order_currency = $order_currency;
123-
$order_total = $order->get_total();
123+
$order_total = $order->get_total() ? $order->get_total() : 0;
124124
$order_number = $order->get_order_number();
125125
$order_subtotal = $order->get_subtotal();
126-
$order_discount = $order->get_total_discount();
127-
$order_shipping = $order->get_total_shipping();
126+
$order_discount = $order->get_total_discount();
127+
$order_shipping = $order->get_total_shipping();
128128

129129

130130
// customer details
@@ -142,8 +142,8 @@ function process_order_markdown( $code, $order_id ) {
142142
$code = str_replace( '{order_total}', $order_total, $code );
143143
$code = str_replace( '{order_number}', $order_number, $code );
144144
$code = str_replace( '{order_subtotal}', $order_subtotal, $code );
145-
$code = str_replace( '{order_discount}', $order_discount, $code );
146-
$code = str_replace( '{order_shipping}', $order_shipping, $code );
145+
$code = str_replace( '{order_discount}', $order_discount, $code );
146+
$code = str_replace( '{order_shipping}', $order_shipping, $code );
147147

148148
return $code;
149149
}

includes/integrations/class-integration-facebook.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ public function add_to_cart() {
123123
$code = $this->build_event( 'AddToCart', array(
124124
'content_ids' => json_encode( $product_ids ),
125125
'content_type' => 'product',
126-
'value' => WC()->cart->total,
126+
'value' => WC()->cart->total ? WC()->cart->total : 0,
127127
'currency' => get_woocommerce_currency()
128128
) );
129129

@@ -169,7 +169,7 @@ public function initiate_checkout() {
169169
'num_items' => WC()->cart->get_cart_contents_count(),
170170
'content_ids' => json_encode( $product_ids ),
171171
'content_type' => 'product',
172-
'value' => WC()->cart->total,
172+
'value' => WC()->cart->total ? WC()->cart->total : 0,
173173
'currency' => get_woocommerce_currency()
174174
) );
175175

@@ -205,7 +205,7 @@ public function checkout( $order_id ) {
205205
$code = $this->build_event( 'Purchase', array(
206206
'content_ids' => json_encode($product_ids),
207207
'content_type' => $content_type,
208-
'value' => $order->get_total(),
208+
'value' => $order->get_total() ? $order->get_total() : 0,
209209
'currency' => get_woocommerce_currency()
210210
) );
211211

includes/integrations/class-integration-google.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public function checkout( $order_id ) {
115115
$code = $this->build_event( 'conversion', array(
116116
'send_to' => sprintf( "%s/%s", $account_id, $label ),
117117
'transaction_id' => $order_id,
118-
'value' => $order->get_total(),
118+
'value' => $order->get_total() ? $order->get_total() : 0,
119119
'currency' => get_woocommerce_currency()
120120
) );
121121

includes/integrations/class-integration-twitter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ public function checkout( $order_id ) {
114114
$code = $this->build_event( 'Purchase', array(
115115
'content_ids' => json_encode($product_ids),
116116
'content_type' => $content_type,
117-
'value' => $order->get_total(),
117+
'value' => $order->get_total() ? $order->get_total() : 0,
118118
'currency' => get_woocommerce_currency()
119119
) );
120120

includes/views/settings.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,7 @@
151151
<li><a href="https://wedevs.com/docs/woocommerce-conversion-tracking/twitter/?utm_source=wp-admin&utm_medium=docs-link&utm_campaign=wcct_docs&utm_content=Twitter" target="_blank"><img src="<?php echo plugins_url( 'assets/images/twitter.png', WCCT_FILE ); ?>" alt="" class="doc-list-icon"><span><?php _e( 'Twitter', 'woocommerce-conversion-tracking' ) ?></span></a></li>
152152
<li><a href="https://wedevs.com/docs/woocommerce-conversion-tracking/google-adwords/?utm_source=wp-admin&utm_medium=docs-link&utm_campaign=wcct_docs&utm_content=Adwords" target="_blank"><img src="<?php echo plugins_url( 'assets/images/adwords.png', WCCT_FILE ); ?>" alt="" class="doc-list-icon"><span><?php _e( 'Google Adwords', 'woocommerce-conversion-tracking' ) ?></span></a></li>
153153
<li><a href="https://wedevs.com/docs/woocommerce-conversion-tracking/perfect-audience/?utm_source=wp-admin&utm_medium=docs-link&utm_campaign=wcct_docs&utm_content=Perfect_Audience" target="_blank"><img src="<?php echo plugins_url( 'assets/images/perfect_audience.png', WCCT_FILE ); ?>" alt="" class="doc-list-icon"><span><?php _e( 'Perfect Audience', 'woocommerce-conversion-tracking' ) ?></span></a></li>
154-
155-
<li><a href="https://wedevs.com/docs/woocommerce-conversion-tracking/bing-ads/?utm_source=wp-admin&utm_medium=docs-link&utm_campaign=wcct_docs&utm_content=Bing_Ads" target="_blank"><img src="<?php echo plugins_url( 'assets/images/bing_ads.png', WCCT_FILE ); ?>" alt="" class="doc-list-icon"><span><?php _e( 'Bing Ads', 'woocommerce-conversion-tracking' ) ?></span></a></li>
156-
154+
<li><a href="https://wedevs.com/docs/woocommerce-conversion-tracking/bing-ads" target="_blank"><img src="<?php echo plugins_url( 'assets/images/bing_ads.png', WCCT_FILE ); ?>" alt="" class="doc-list-icon"><span><?php _e( 'Bing Ads', 'woocommerce-conversion-tracking' ) ?></span></a></li>
157155
<li><a href="https://wedevs.com/docs/woocommerce-conversion-tracking/custom/?utm_source=wp-admin&utm_medium=docs-link&utm_campaign=wcct_docs&utm_content=Custom" target="_blank"><img src="<?php echo plugins_url( 'assets/images/custom.png', WCCT_FILE ); ?>" alt="" class="doc-list-icon"><span><?php _e( 'Custom', 'woocommerce-conversion-tracking' ) ?></span></a></li>
158156
</ul>
159157
</div>

0 commit comments

Comments
 (0)