Skip to content

Commit

Permalink
Prevent fatal error caused invalid filter input
Browse files Browse the repository at this point in the history
  • Loading branch information
TorbenLundsgaard committed Aug 16, 2024
1 parent 3265f1a commit b23a1e1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Integration/WooCommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,11 @@ public function get_cart_items( string $event_context ): array {
*
* @return array The item data.
*/
public function get_item_data( WC_Product $product, array $additional_item_attributes = [], string $event_context = '' ): array {
public function get_item_data( $product, array $additional_item_attributes = [], string $event_context = '' ): array {

if ( ! ( $product instanceof WC_Product ) ) {
return [];
}

$product_id_to_query = ( $product->get_type() === 'variation' ) ? $product->get_parent_id() : $product->get_id();

Expand Down

0 comments on commit b23a1e1

Please sign in to comment.