fbpx
Want To Add Extra Images Per Product Variation For Free? Download Now

Change Add to cart text

Albin Dahlin

Hello,

I am trying to change the add to cart text but a simple function isnt working because .wvs-add-to-cart-button is replacing the original add to cart button. Is this achievable with a function?

I want to change the text “LÄGG TILL I VARUKORG” on this site: https://whitelipse.wpcomstaging.com/

Kind regards

Hakik Zaman

Hi Albin,

Thanks for reaching out to us.

You can try the following snippet using a plugin like Code Snippets:

add_filter( 'woo_variation_swatches_archive_add_to_cart_text', function( $default, $variation, $product ){
return 'LÄGG TILL I VARUKORG';
}, 10, 3 );

You can also add this inside your current theme’s functions.php.

Note: It is recommended to add the Custom Code to the child theme’s functions.php file, to avoid any data loss while updating the Parent Theme.

Hope to hear from you soon.

Thank You

Albin Dahlin

Hello Hakik,

That did not seem to work unfortunately…

It works if i remove .wvs-add-to-cart-button from settings but then it wont add products to cart.

Kind regards,

Albin

Hakik Zaman

Hi Albin,

Can you please give us temporary admin access to your site? We’ll try to investigate how you add the code.

You can use this plugin to create instant passwordless login links.

Or,

You can add new users by going to Users > Add New set the user and password for us, set the role to admin, and set the info here.

Add your site URL, login username, and password in the site login area. Follow this guideline: https://www.useloom.com/share/27c1f2ac633c4060b2da883d946107d7

Hope to hear from you soon!

Albin Dahlin

Hello again Hakik,

Actually it worked! I think it was cached but now it seems to be working, thank you for the help!