0

Of ~800 Commerce product variations, ~30 are not available for purchase on their respective display pages. These offending variations are completely set up like their brothers & sisters, Title, pricing, sku, and status. I see nothing wrong with them, through the /admin/ gui. But when visiting the display pages, for these offending products, Add to Cart is displayed as Product not available.

I can't find any information online concerning a similar problem. I'm also novice enough, to not know the best way to go about solving this issue.

Drupal and Commerce are the latest versions. If there's any other information I can offer, please let me know.

11
  • 1
    nothing to do with stock? Jan 9 '14 at 16:14
  • @DanielHarper you beat me ;) zer0, have you checked how many of them your site thinks you have available for sale?
    – Mołot
    Jan 9 '14 at 16:17
  • @DanielHarper No stock modules installed.
    – zer0
    Jan 9 '14 at 20:10
  • @Molot the last list I saw of the problem products was at 28, but I think there were two others, not on the list.
    – zer0
    Jan 9 '14 at 20:14
  • And what's in the status field? Screenshot that shows field I'm talking about, don't mind what's written on the image, it's unrelated to this issue.
    – Mołot
    Jan 9 '14 at 20:21
1

The actual issue here is that Commerce products cannot have a price of 'NULL' or empty. Commerce has requirements that typically prevents the price field from ever being null or empty, but certain modules or pricing calculations can override this default required behavior and basically leave the Price field "orphaned."

For my use case, it was with the Commerce Pricing Table module. The module removes the default requirement for Price and has a configuration option to hide it so that its pricing tables take precedence. The design flaw in that module is that it operates on Commerce Line Items but forgets to set a price for the Price field, even though that field is never used.

For us, we created a simple Rule.

-> Event: When saving a new product -> Condition: if Empty Value = Price field -> Action: set price to 0

In Commerce 1.x since a variation is simply an independent product with specific attributes, this makes sure that all items have at least a price of 0 and will function as expected.

0

In my case it depended on which variation I physically have first in the variation list. If the product I have first in the variation list has a price and positive stock number, then I get an Add To Cart button for all variations.

If the product I have first in the variation list does NOT have a price greater than $0 and positive stock number then for ALL variations I get "Product Not Available".

So for me physically dragging and changing the order of the variations is what changed whether I saw Add to Cart, or Product not Available - I had to have an eligible product listed first in the variation order.

The only catch is, it allows you to click the Add To Cart button on products that are not eligible for checkout, however it does not add anything to the cart or functionally mess things up.

Naturally I would prefer the Add To Cart button change dynamically depending on the status and info of that variation, but technically this works.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.