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.
Hi,
I'm using field collection module to group common field for every product type, simply to save time on adding the same fields on and on to about 30 product types. While everything displays properly on the product display node, switching products in the "Add to Card" form doesn't refresh fields attached to the field collection (rest of the fields like price is refreshed as desired). Should I loose a whole day on switching to normal fields setup or rather there's a work around?
Comments
Comment #1
rszrama CreditAttribution: rszrama commentedI don't think you need to lose a day anywhere, but it could be that the abstraction provided by the Field Collection prevents its fields from being rendered to the page with the necessary wrappers provided for the other fields. Check the HTML to see if there's a span around the Field Collection fields that the Add to Cart form could use to target those rendered fields for replacement. I have no knowledge of how that module renders fields, so it could be that it just won't be compatible without extra integration in that module. : ?
Comment #2
rszrama CreditAttribution: rszrama commentedComment #3
rszrama CreditAttribution: rszrama commentedNever heard back from the OP, but I went ahead and tried this and discovered that indeed the wrapper div wasn't being set around the rendered field collection because its content array already included a #prefix and #suffix before we tried to add the div with a union. I've changed the way we add the div around injected fields and extra fields to support pre-existing prefixes and suffixes.