File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed
Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -399,7 +399,7 @@ public function maybe_display_conversion_and_purchase_event_snippets( string $ad
399399 // Get the item info in the order
400400 $ item_info = [];
401401 foreach ( $ order ->get_items () as $ item_id => $ item ) {
402- $ product_id = $ item ->get_product_id ();
402+ $ product_id = $ item ->get_variation_id () ?: $ item -> get_product_id ();
403403 $ product_name = $ item ->get_name ();
404404 $ quantity = $ item ->get_quantity ();
405405 $ price = $ order ->get_item_total ( $ item );
@@ -505,7 +505,7 @@ private function display_page_view_event_snippet(): void {
505505
506506 foreach ( WC ()->cart ->get_cart () as $ cart_item ) {
507507 // gets the product id
508- $ id = $ cart_item ['product_id ' ];
508+ $ id = ! empty ( $ cart_item [ ' variation_id ' ] ) ? $ cart_item [ ' variation_id ' ] : $ cart_item ['product_id ' ];
509509
510510 // gets the product object
511511 $ product = $ cart_item ['data ' ];
You can’t perform that action at this time.
0 commit comments