Title: Request &#8211; Product Button &#8211; replace for specific products
Last modified: July 18, 2022

---

# Request – Product Button – replace for specific products

 *  Resolved [koolpal](https://wordpress.org/support/users/koolpal/)
 * (@koolpal)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/request-product-button-replace-for-specific-products/)
 * Hi,
 * This is a request. Is there any way to replace Product Button (near the Add to
   cart button) using the meta box in Edit Product page?
 * Currently, the changes are seen ONLY in the footer – Call to Action for Products
 * Code snippet with also help.
 * Thanks

Viewing 6 replies - 1 through 6 (of 6 total)

 *  Plugin Author [Creame](https://wordpress.org/support/users/creapuntome/)
 * (@creapuntome)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/request-product-button-replace-for-specific-products/#post-15839689)
 * Adapting [this snippet](https://wordpress.org/support/topic/show-only-in-certain-categories-mostrar-solo-en-ciertas-categorias/#post-15797608)
   a bit, you can use custom fields to modify the button.
 * In this example, use the custom fields `'_joinchat_woo_btn_view'` and `'_joinchat_woo_btn_text'`
   to change the behavior of the Product Button:
 *     ```
       /**
        * Change Joinchat product button with custom fields
        */
       function joinchat_woobtn_custom_setting( $settings, $obj ) {
   
         // Exit if not is product.
         if ( ! is_singular( 'product' ) ) return $settings;
   
         $visibility = get_post_meta( $obj->ID, '_joinchat_woo_btn_view', true );
         $text       = get_post_meta( $obj->ID, '_joinchat_woo_btn_text', true );
   
         if ( 'yes' === $visibility ) {
           $settings['woo_btn_position'] = 'woocommerce_after_add_to_cart_button';
         }
   
         if ( 'no' === $visibility ) {
           $settings['woo_btn_position'] = 'none';
         }
   
         if ( $text ) {
           $settings['woo_btn_text'] = $text;
         }
   
         return $settings;
       }
       add_filter( 'joinchat_get_settings_site', 'joinchat_woobtn_custom_setting', 10, 2 );
       ```
   
 *  Thread Starter [koolpal](https://wordpress.org/support/users/koolpal/)
 * (@koolpal)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/request-product-button-replace-for-specific-products/#post-15841982)
 * Hi,
 * Thanks for your attempt to help me. I really appreciate it. Perhaps my request
   was not clear.
 * Let me try again
 * I am trying to change the button near Add to Cart as seen here
    [](https://imgur.com/96Sy2t5)
 * And replace this Button Text and Number with changes made in Edit Product as 
   seen here
    [](https://imgur.com/yJ4uG2Q)
 * But the change is ONLY seen at the bottom of the page as seen here
    [](https://imgur.com/CuvxbDK)
 * Can you please help so that the change is seen NEAR Add to Cart?
 * Thanks a lot
 *  Plugin Author [Creame](https://wordpress.org/support/users/creapuntome/)
 * (@creapuntome)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/request-product-button-replace-for-specific-products/#post-15878241)
 * Ok,
 * “Telephone” and “Message” from Joinchat metabox will be the same for product 
   button. “Call to Action” it’s only for Joinchat chatbox, as you said but whit
   this code metabox CTA text will be used for product button (you can even hide
   Joinchat floating button and leave only product button):
 *     ```
       /**
        * Change Joinchat product button text with metabox CTA
        */
       function joinchat_woobtn_text_from_metabox_cta( $settings, $obj ) {
   
       	$obj_settings = '';
       	if ( is_singular( 'product' ) ) {
       		$obj_settings = get_post_meta( $obj->ID, '_joinchat', true );
       	}
   
       	if ( is_array( $obj_settings ) && isset( $obj_settings['message_text'] ) ) {
       		$settings['woo_btn_text'] = $obj_settings['message_text'];
       	}
   
       	return $settings;
       }
       add_filter( 'joinchat_get_settings_site', 'joinchat_woobtn_text_from_metabox_cta', 9, 2 );
       ```
   
 *  Thread Starter [koolpal](https://wordpress.org/support/users/koolpal/)
 * (@koolpal)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/request-product-button-replace-for-specific-products/#post-15879740)
 * [@creapuntome](https://wordpress.org/support/users/creapuntome/) Thanks a lot.
   This is getting closer.
 * Would you help with some changes to the code so that Joinchat floating button
   shows the ORIGINAL number / text as defined globally?
 * I want ONLY the product button to show different number / message as defined 
   in individual product.
 * Thanks again for taking some time to help me here. God bless you!
 *  Plugin Author [Creame](https://wordpress.org/support/users/creapuntome/)
 * (@creapuntome)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/request-product-button-replace-for-specific-products/#post-15880182)
 * I’m sorry, as the plugin is currently designed, it is complicated to put a different
   number to the product button and mantain global phone.
 * The most viable option is to use the code above and hide the floating button 
   for products that have a number other than the general one.
 *  Thread Starter [koolpal](https://wordpress.org/support/users/koolpal/)
 * (@koolpal)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/request-product-button-replace-for-specific-products/#post-15880199)
 * [@creapuntome](https://wordpress.org/support/users/creapuntome/) Thank you for
   your prompt response.
 * I will mark this as resolved for later use.

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Request – Product Button – replace for specific products’ is closed to
new replies.

 * ![](https://ps.w.org/creame-whatsapp-me/assets/icon-256x256.gif?rev=2699533)
 * [Joinchat - Enhanced "click to chat"](https://wordpress.org/plugins/creame-whatsapp-me/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/creame-whatsapp-me/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/creame-whatsapp-me/)
 * [Active Topics](https://wordpress.org/support/plugin/creame-whatsapp-me/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/creame-whatsapp-me/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/creame-whatsapp-me/reviews/)

 * 9 replies
 * 2 participants
 * Last reply from: [koolpal](https://wordpress.org/support/users/koolpal/)
 * Last activity: [3 years, 11 months ago](https://wordpress.org/support/topic/request-product-button-replace-for-specific-products/#post-15880199)
 * Status: resolved