Translate buy it now button (Refresh theme)

Topic summary

A user needed help translating the “Buy it now” button on their Shopify store (planeta.is) from English to Icelandic. Their initial attempt using JavaScript code in theme.liquid failed.

Solutions Offered:

  • PageFly-Richard suggested adding CSS code to section-main-product.css that hides the original button text and replaces it with custom content using the :after pseudo-element, targeting specific language attributes (html[lang=“en”] and html[lang=“IS-si”]).
  • Another user (infoatcodelab7) offered a JavaScript-based solution.

Outcome:
The issue was resolved successfully. While the user confirmed one solution worked, they didn’t specify which approach ultimately solved the problem. The discussion is now closed with the translation implemented.

Summarized with AI on November 22. AI used: claude-sonnet-4-5-20250929.

Need help translating the “buy it now” button.

Store:

https://planeta.is

Tried following some other solutions like pasting this code in the theme.liquid before the /body but it doesn’t work

Hi @Sighouf ,

This is Richard from PageFly - Landing page builder, I’d like to suggest this idea:
Step 1: Go to Online Store->Theme->Edit code
Step 2: Asset->/section-main-product.css->paste below code at the bottom of the file:

html[lang="en"] button.shopify-payment-button__button {
	 font-size: 0;
}
 html[lang="en"] button.shopify-payment-button__button:after {
	 content: "Buy now";
	 font-size: 1.5rem;
	 position: static;
}
 html[lang="is-IS"] button.shopify-payment-button__button {
	 font-size: 0;
}
 html[lang="is-IS"] button.shopify-payment-button__button:after {
	 content: "Kaupa strax";
	 font-size: 1.5rem;
	 position: static;
}

I hope it would help you
Best regards,

Richard | PageFly

2 Likes

@Sighouf

Try below code


If works then let me know.

Best Regards !

This did not work :disappointed_face: But thank you for your effort.

I got a solution from another reply.

Works, thank you so much.

1 Like