https://solidus.io logo
Title
u

Ulysses

05/25/2023, 2:35 PM
I'm trying to disable the option type selectors for out of stock variants in the product page. I understand that the user wouldn't be able to proceed with the checkout if unbackourderable products without any on hand quantity are included in their order, but it would be nicer to have that information on the product page so they can only select in stock items. I've noticed that the option type selector (views\cart_line_items\product_selection\_option_type.html.erb) works with a hidden form for the actual variants in (app\views\cart_line_items\_product_variants.html.erb). The hidden form even adds an out of stock class to unavailable variants, but this is not relflected in the option type selector that is displayed for the user. I understand the complexity of this interface, as the availability of each option type is dependent on the other options already selected. So, I would like to know if this is supported out of the box or a suggested implementation exists. If not, why is the hidden product variant form adding an out of stock class to unavailable variants?
k

kennyadsl

05/25/2023, 3:11 PM
Hey @Ulysses! Which frontend are you using? the starter fronted? Are you using this JS? I can see that there’s a reference to disable the add to cart button when it’s out of stock here, can you please verify the differences in the code you are using?
u

Ulysses

05/26/2023, 2:48 PM
I'm using the starter frontend. In the updateStockView method of this JS file, how would these targets work? Because I tried to call this method and it returned an error that the targets are not defined.
in the starter frontend app\assets\javascripts\product_selection_component.js:27, what is the expected usage of the updateStockView method? I'm trying to implement js logic to only allow selection of in stock variants, this function seems like it has something to do with that but I can`t find any references to it`s usage.
k

kennyadsl

05/31/2023, 12:54 PM
Yes, I think they are leftovers from a previous implementation. We are revisiting that part but I don’t know exactly when