An Expression Question

I'm working on an Add to My Cart Action, which can apply to a Product but only once, which is a user can not add the same product twice to the Cart. However, this expression seems to not work, any ideas on fix?

Leonsk2037_0-1666724374785.png

the logic for this expression is that the current user can not put his own product to the cart, and from the Cart table select all rows' email columns that referenced this product and check if the current user's email is one of them.

 

Solved Solved
0 3 120
1 ACCEPTED SOLUTION

Aurelien
Google Developer Expert
Google Developer Expert

Hi @Leonsk2037 

What about:

AND(
  USEREMAIL()<>[Seller Email],
  ISBLANK(
    FILTER("Cart",
      AND(
        USEREMAIL()=[User Email],
        [Product Title]=[_THISROW].[Product Title]
      )
    )
  )
)

View solution in original post

3 REPLIES 3

Oh and for "seems to not work", I mean now user can add the same item to his cart infinite times

Aurelien
Google Developer Expert
Google Developer Expert

Hi @Leonsk2037 

What about:

AND(
  USEREMAIL()<>[Seller Email],
  ISBLANK(
    FILTER("Cart",
      AND(
        USEREMAIL()=[User Email],
        [Product Title]=[_THISROW].[Product Title]
      )
    )
  )
)

Works perfetly. Thanks!

Top Labels in this Space