Support » Plugin: Product Addons & Fields for WooCommerce » Product Button Text

  • Resolved mcecomputing

    (@mcecomputing)


    I am trying to change the button text of products with forms from “Select Options”

    I have tried the suggested changes using the filter and changing the variable product text but the button text doesn’t change.

    Any suggestions on where to look to change that text?

    Thanks,

    Vince

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi,

    you need do use filter like this:

    `add_filter(‘ppom_select_option_lable’, ‘change_select_option’);
    function change_select_option( $select_label ) {
    $select_label = “My Label”;
    return $select_label;
    }’

    Thread Starter mcecomputing

    (@mcecomputing)

    Ok, I tried adding that filter to my functions.php but the button is still labelled “Select Options”. Is there another file I should be adding this too?

    Thanks,

    Vince

    Thread Starter mcecomputing

    (@mcecomputing)

    I now have these filters in my functions.php

    
    add_filter( 'woocommerce_product_add_to_cart_text' , 'custom_woocommerce_product_add_to_cart_text' );
    /**
     * custom_woocommerce_template_loop_add_to_cart
    */
    function custom_woocommerce_product_add_to_cart_text() {
    	global $product;
    	
    	$product_type = $product->product_type;
    	
    	switch ( $product_type ) {
    		case 'external':
    			return __( 'Buy product', 'woocommerce' );
    		break;
    		case 'grouped':
    			return __( 'View products', 'woocommerce' );
    		break;
    		case 'simple':
    			return __( 'Add to cart', 'woocommerce' );
    		break;
    		case 'variable':
    			return __( 'Buy Now', 'woocommerce' );
    		break;
    		default:
    			return __( 'Read more', 'woocommerce' );
    	}
    	
    }
    
    // END ENQUEUE PARENT ACTION
    
    add_filter('ppom_select_option_label', 'change_select_option');
    
    function change_select_option( $select_label ) {
      $select_label = "Buy Now";
      return $select_label;
    }
    • This reply was modified 6 years, 4 months ago by mcecomputing.
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Product Button Text’ is closed to new replies.