Skip to content

Commit 176dc7c

Browse files
authored
Allow attribution on orders with no product items. (#160)
1 parent e2ae6f4 commit 176dc7c

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

includes/Generator/OrderAttribution.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,11 @@ public static function add_order_attribution_meta( $order, $assoc_args = array()
3131

3232
$order_products = $order->get_items();
3333

34-
if ( empty( $order_products ) ) {
35-
return;
36-
}
37-
3834
$device_type = self::get_random_device_type();
3935
$source = 'woo.com';
4036
$source_type = self::get_source_type();
4137
$origin = self::get_origin( $source_type, $source );
42-
$product_url = get_permalink( $order_products[ array_rand( $order_products ) ]->get_id() );
38+
$product_url = empty( $order_products ) ? '' : get_permalink( $order_products[ array_rand( $order_products ) ]->get_id() );
4339
$utm_content = array( '/', 'campaign_a', 'campaign_b' );
4440
$utm_content = $utm_content[ array_rand( $utm_content ) ];
4541

0 commit comments

Comments
 (0)