Changing add to cart button text if the product is backorders allowed
-
I need to change the text shown in the button “add to cart” to explicit inform to costumer that pressing it will backorder the product that only can allow it.
I created this code, but nothing changes. If I put add_filter out, it affects to everything, and I don’t want to specify with a function every type of purchase or free downloadable and free stuff I offer. I only need to change this condition.
Thank you in advance!add_action( 'woocommerce_after_add_to_cart_form', 'custom_woocommerce_after_add_to_cart_form' ); function custom_woocommerce_after_add_to_cart_form() { global $product; if ( $product->backorders_allowed() ) { add_filter( 'woocommerce_product_single_add_to_cart_text', 'texto_boton_reserva' ); ?> PRODUCTO AGOTADO. PUEDES RESERVARLO Y TE LO ENVIAREMOS TAN PRONTO LLEGUE A NUESTROS ALMACENES. <?php } } function texto_boton_reserva(){ return __('Reservar','woocommerce'); }
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
- The topic ‘Changing add to cart button text if the product is backorders allowed’ is closed to new replies.