please print the code from # Check if the user wants to add the product to their cart
 if 'add to cart' in question.lower():
 product\_name = question.lower().split('add to cart ')[-1]
 mycursor.execute("SELECT \* FROM inventory WHERE product\_name = %s", (product\_name,))
 result = mycursor.fetchone()
Certainly! Here’s the code snippet you provided, formatted correctly:

```python
# Check if the user wants to add the product to their cart
if 'add to cart' in question.lower():
    product_name = question.lower().split('add to cart ')[-1]
    mycursor.execute("SELECT * FROM inventory WHERE product_name = %s", (product_name,))
    result = mycursor.fetchone()
```

Make sure to replace `mycursor` with your actual database cursor variable if it's named differently in your code. Additionally, ensure you handle the case where `result` might be `None` if the product is not found in the inventory.
 Here is the code you requested:

```python
# Check if the user wants to add the product to their cart
if 'add to cart' in question.lower():
    product_name = question.lower().split('add to cart ')[-1]
    mycursor.execute("SELECT * FROM inventory WHERE product_name = %s", (product_name,))
    result = mycursor.fetchone()
```

This code checks if the user's input contains the phrase "add to cart". If it does, the code extracts the product name from the user's input and queries the database to fetch the details of the product. The `mycursor.fetchone()` method returns a tuple containing the first row of the result set, which can be used to access the product details.