Skip to content

Commit 086b4ab

Browse files
committed
Fixed: Call to a member function get_data on bool.
1 parent 005e849 commit 086b4ab

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Integrations/WooCommerce.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,10 @@ public function track_direct_add_to_cart() {
204204
* @codeCoverageIgnore Because we can't test XHR requests here.
205205
*/
206206
public function track_add_to_cart( $product, $add_to_cart_data ) {
207+
if ( ! $product ) {
208+
return;
209+
}
210+
207211
$product_data = $this->clean_data( $product->get_data() );
208212
$added_to_cart = $this->clean_data( $add_to_cart_data );
209213
$cart = WC()->cart;

0 commit comments

Comments
 (0)