Site logo

Archived topic

Change "select options" in products. Site library: niche

5 replies · Started by Antonio Farelo Serén on April 8, 2022

Viewing posts 1–6 of 6

Buenas tardes, estoy desarrollando un woocommerce con Niche. Cómo podría cambiar el texto que aparece de "Seleccionar opciones" en los bloques de la home. Me gustaría poner por ejemplo "Elige tu talla" o "Ver producto".

Imagino que con un snippet de php pero no acierto a solucinarlo correctamente...

Gracia spor su ayuda.

Hi there,

where are the 'Select Options' that you want to change?
Can you share a screenshot ?

Perdón... No acierto a poder subir una imagen en esta respuesta... Tengo la web en local. Me refiero al texto que aparece al pasar por encima de uno de los productos que aparecen en la home de Niche. Los propios que ya vienen precargados. Como tengo productos variables aparece la "Seleccionar opciones" en vez de "Añadir al carrito".

Me gustaría poder cambiar ese texto. No sé si he conseguido explicarme con claridad. Disculpe las molestias

OK - so you need to add a PHP Snippet like this:

add_filter( 'woocommerce_product_add_to_cart_text', function( $text ) {
	global $product;
	if ( $product->is_type( 'variable' ) ) {
		$text = $product->is_purchasable() ? __( 'Custom options text', 'woocommerce' ) : __( 'Read more', 'woocommerce' );
	} else {
                $text = $product->is_purchasable() ? __( 'Custom Buy Now', 'woocommerce' ) : __( 'Read more', 'woocommerce' );
        }
	return $text;
}, 10 );

In the code you need to change for:

Options: Custom options text
Add to Cart: Custom Buy Now

And there are 2 x instances of: Read more that you can change for Sold Out products button text

Perfecto! Solucionado!!! Muchas gracias!!

You're welcome!

This archived topic is closed to new replies.