0 is numeric but also is empty. We need a more specific check for no-value input.

CommentFileSizeAuthor
#1 commerce-2092799.patch862 bytesjonhattan

Comments

jonhattan’s picture

Status: Active » Needs review
StatusFileSize
new862 bytes
rszrama’s picture

I noticed this the other day, too. What about using is_null() instead?

jonhattan’s picture

I think the value I saw was an empty string, not a null. I'll check and confirm tomorrow.

MD3’s picture

This caught my attention because I was just reading #1658788: Stop add to cart based on rules and #1909098: Allow rules to disable add to cart form where one of the suggestions to stop an item from being adding to the cart is to set it's price to 0. In the commerce_cart function commerce_cart_product_add() the first check is to see of the price is_null().

Would making these checks match would preserve current functionality?

jonhattan’s picture

@rszrama I confirm the value isn't NULL, but empty string.

@MD3 I have no idea where commerce-line-item:commerce-unit-price:amount is validated, but for sure it's not the same piece of code we're dealing here. With or without this patch, NULL is not allowed here anyway.

rszrama’s picture

Status: Needs review » Fixed

Alrighty, thanks for checking for me. Committed!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.