Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
But I still have the same problem with the price and the reference that does not show up. I never succeeded in resolving this.
Commerce 2 is really very complicated.
I use "Display Suite" for displaying product pages.
I copied the file "bs-2col-stacked--commerce-product.html.twig" into the templates folder of my theme.
Here are contents :
{#
/**
* @file
* Bootstrap Layouts: "2 Columns (stacked)" template.
*
* Available layout variables:
* - wrapper: Wrapper element for the layout container.
* - attributes: Wrapper attributes for the layout container.
*
* Available region variables:
* - top
* - left
* - right
* - bottom
*
* Each region variable contains the following properties:
* - wrapper: The HTML element to use to wrap this region.
* - attributes: The HTML attributes to use on the wrapper for this region.
* - content: The content to go inside the wrapper for this region.
*/
#}
<{{ wrapper }}{{ attributes }}>
{{ title_suffix.contextual_links }}
{% if top.content %}
<{{ top.wrapper }}{{ top.attributes }}>
{{ top.content }}
</{{ top.wrapper }}>
{% endif %}
{% if left.content %}
<{{ left.wrapper }}{{ left.attributes }}>
{{ left.content }}
</{{ left.wrapper }}>
{% endif %}
{% if right.content %}
<{{ right.wrapper }}{{ right.attributes }}>
{{ right.content }}
</{{ right.wrapper }}>
{% endif %}
{% if bottom.content %}
<{{ bottom.wrapper }}{{ bottom.attributes }}>
{{ bottom.content }}
</{{ bottom.wrapper }}>
{% endif %}
</{{ wrapper }}>
What should I do ?
I also encounter problems with views and product variations.
It's a nightmare.
https://drupal.stackexchange.com/questions/241357/commerce-2-the-price-o...
Thank you
Comment | File | Size | Author |
---|---|---|---|
#4 | screenshot5.png | 148.24 KB | zenimagine |
#4 | screenshot4.png | 175.99 KB | zenimagine |
#4 | screenshot3.png | 19.59 KB | zenimagine |
#4 | screenshot2.png | 5.42 KB | zenimagine |
#4 | screenshot1.png | 123.58 KB | zenimagine |
Comments
Comment #2
zenimagine CreditAttribution: zenimagine commentedComment #3
bojanz CreditAttribution: bojanz at Centarro commentedStop using Display Suite. We don't support it, and your hidden fields problem is coming from there.
Comment #4
zenimagine CreditAttribution: zenimagine commented@bojanz
I use the following modules on my product pages :
- Display Suite
- Bootstrap Layouts
They are indispensable to me.
I found a solution to display the missing fields :
- screenshot1: create a product view with the product variations fields and add a contextual filter to display the same product as the current page.
- screenshot2: create a display block of the previous ue created.
- screenshot3: add the display block following the product type display.
- screenshot4: it works, the fields are correctly displayed on my product page.
- screenshot5: PROBLEM When I change the variation of my product, the price and sku fields are not updated. I have the same problem on all my product views.
I do not use search API for the view. But it should still work, I do not understand why. I've been looking for a solution for a week, but I can not find anything.
https://drupal.stackexchange.com/questions/241357/commerce-2-the-price-o...
Comment #5
bojanz CreditAttribution: bojanz at Centarro commented@zenimagine
I keep repeating in various issues: If you use Display Suite, you can't show variation fields (including the price).
Variation field injection is only performed when you use vanilla Drupal theming.
We have never claimed Display Suite compatibility.
You have been first told this 2 months ago. Nothing has changed.
Comment #6
zenimagine CreditAttribution: zenimagine commented@bojanz
I understand that display suite is not compatible with commmerce 2. But in my previous comment, I use a view (without display following). Even when creating a classic view page without display, the problem is still there (change of variation does not change the price and sku).
Comment #7
zenimagine CreditAttribution: zenimagine commented@bojanz
http://docs.drupalcommerce.org/v2/product/create-a-product-catalog.html
In the documentation you show products with color variations and that's it. No problem it also works for me.
Try displaying the "price" and "reference" fields in your view.
My question is simple: when you change the variation with the drop-down button, does the "price" and "reference" field vary?
For me NO, I also do the test on simplytest.me without adding any additional module and it does not work.
Logically the "price" and the "reference" should vary, exact?
The "Created a Product Catalog" declaration is not correctly explained. You should also explain how you do not have the same product displayed several times in the view (for example, a product with three variations will appear three times in the view).
I do not speak English, but I hope my question is understood.
The catalog example should at least display the price.
https://drupal.stackexchange.com/questions/241357/commerce-2-the-price-o...
Comment #8
zenimagine CreditAttribution: zenimagine commentedI tested the change in the views on a blank site with simplytest.me and it does not work.
Create a product with two variations (two different prices).
I would like to know if you arrived to update the price by changing the variation in a view ?
Comment #9
bojanz CreditAttribution: bojanz at Centarro commentedCommerce has no way of magically detecting Views fields and replacing them. If you want fields to change when the variation changes, you need to show them as a part of the rendered product, just like on the product display page.
Comment #10
zenimagine CreditAttribution: zenimagine commentedComment #11
zenimagine CreditAttribution: zenimagine commentedThank you that is clearer
Comment #12
FiNeX CreditAttribution: FiNeX as a volunteer commentedHi, the DS compatibility is discussed here: https://www.drupal.org/project/commerce/issues/2723689