How to display only part of the product part number

Hello.

We have part numbers which contain hashtag, like this:

RRP584#Sport

We only want to display the part number up to the hashtag, we don’t want anything including and after the hashtag to be displayed, like this:

RRP584

We display the part number (SKU) like this:

Part number: {% assign current_variant = product.selected_or_first_available_variant %} {{ current_variant.sku }}

Is there some logic we can add to do this?

Thanks

Hello @BenPF

Could you please share your store URL or the page link ( with a pass if your store password is enabled ). I think I can give you the right solution.

Hi @GemPages

URL is trade4x4.myshopify.com

I checked, the code you used is correct
The content displayed is the content entered in the SKU
You should type content with only the content you want
eg: RRP584

Hello yes, but we would only like to display the part number before the #

@BenPF

Try this code


Part number:
{% assign current_variant = product.selected_or_first_available_variant %}
{% assign sku = current_variant.sku | split: "#" %}
{{ sku.first }}

Try it and let me know

@ExpertRookie that worked!! THANK YOU