1

I have a product catalog built using search api, facets, and views like this: https://docs.drupalcommerce.org/commerce2/developer-guide/products/marketing-products/product-catalog-facets. My add to cart form is using the Variation Title widget.

I want to render the product price, and when there's multiple variations I want the price of the variation currently selected to render.

If I add a relationship to the referenced variations and display the price I get from that, prices for all variations are rendered (and not just the price of the variation currently selected in the add to cart dropdown).

If I add a relationship to the default variation, only one price is rendered but it is not updated when another variation is selected in the dropdown.

If I edit the add to cart form itself (Commerce > Configuration > Order item types > Edit Default > Manage form display) and add the unit price, it's rendered as an editable text field and selecting another variation with a different price doesn't update the price.

Would love some input on this. There's a similar question here, but the suggested answers doesn't work.

2

1 Answer 1

0
+50

"I want to render the product price, and when there's multiple variations I want the price of the variation currently selected to render."

-- please read this ---

http://drupal.org/project/commerce/issues/2930046#comment-12384089

if that does not help then perhaps could get tricky with something like this

http://drupal.org/project/view_entity_ref_field_formatter

1
  • Thanks again. A small note/fyi, the patch doesn't support promotions (ie. it shows the list price, not the calculated price on variations subject to a promotion). Commented Nov 26, 2022 at 11:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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