It would be useful to be able to theme Order Adjustments individually to highlight/hide items as required.

Adding a class based on the label would make this easier & more reliable for most types and makes it 'do-able' in css instead of js.

Patch to follow.

Comments

AndyD328 created an issue. See original summary.

andyd328’s picture

Patch adds a class to each Adjustment in the form

order-total-line__adjustment--gst

using the twig template commerce-order-total-summary

Let me know if there's a better way or style to do this, happy to rework it.

Thanks!

andyd328’s picture

Assigned: andyd328 » Unassigned
Status: Active » Needs review
andyd328’s picture

Had another use for this patch, it seems it would be much better to add the adjustment Type and SourceId as classes and not the label.
Patch attached.

bojanz’s picture

Title: Add easy way to identify adjustments in markup » Add additional CSS classes to the order total summary for targeting adjustments

Marked #3031826: Add adjustment type class for theming purpose on commerce order total summary as duplicate.

I definitely agree with adding a class for the adjustment type.

Unsure about the source though, cause the source ID is sometimes numeric (promotions, fees, shipping). It's only ever useful for taxes, but I'm not convinced there's a majority use case for styling one tax differently from the other?

finex’s picture

@bojanz: IMHO styling different taxes is not probably as useful as styling adjustment types.

andyd328’s picture

Thanks for the feedback.

I agree that the adjustment type is really the key item here, but if you did need to separate the sub types of taxes/adjustments you wouldn't be able to without the source as well.
For my uses just being able to identify the type works so happy to go with or without source. Patch attached with only adjustment type, also removed white space around twig | filter

  • bojanz committed 24d480e on 8.x-2.x authored by AndyD328
    Issue #2955932 by AndyD328, FiNeX: Add additional CSS classes to the...
bojanz’s picture

Status: Needs review » Fixed

Committed, thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.