Skip to content

Conversation

@royduin
Copy link
Member

@royduin royduin commented Dec 4, 2025

Follow up on: #1074, extracted some logic to helpers so this can be used more widely; mostly useful for places where products prices are rendered without the <add-to-cart> component; like the autocomplete.

Ref: RAP-1699

@royduin royduin requested a review from indykoning as a code owner December 4, 2025 13:47
@royduin royduin requested a review from Jade-GG December 4, 2025 13:52
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it make sense to put these here? Given that we're not really using Vue filters anymore (as they don't exist anymore in Vue3) this is starting to look more like a general helpers.js to me. Might be worth renaming the file now that we're still in pre-release territory.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestions? 😇

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My suggestion would then be helpers.js

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I created a follow up for this with ref: RAP-1703

</div>
<div class="text-sm text font-sans font-bold">
@{{ window.price(item.special_price || item.price) }}
@{{ window.price(window.productSpecialPrice(item) || window.productPrice(item)) }}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this still the best way to go here now that we're adding helper functions? For example, could we consider turning this into something like:

<div v-if="window.originalPrice(item)" class="line-through">
    @{{ window.originalPrice(item) }}
</div>
<div class="font-bold">
    @{{ window.lowestPrice(item) }}
</div>

(there's probably better ways to name these, this is just an example)

Or should we stick to how it's always been to avoid hiding away functionality behind unnecessary helper functions?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can imagine we don't need the formatting all the time, that's why currently the double wrapping is used. We could introduce more helpers like productSpecialPrice and productSpecialPriceFormatted?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I should have included the price helper here still. I was talking about doing away with just having price and specialPrice and instead having specific functions for originalPrice and lowestPrice. It's probably wholly unnecessary, but something I thought was worth considering 🙂

@royduin
Copy link
Member Author

royduin commented Dec 10, 2025

Please review @indykoning 😇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants