Digital experiences for all disciplines
New Landing › How can we help? › Themeforest Theme Support › Neighborhood › Change "Select Options" button for variable products
New Landing › How can we help? › Themeforest Theme Support › Neighborhood › Change "Select Options" button for variable products
- This topic has 14 replies, 4 voices, and was last updated 9 years by Mohammad – SUPPORT.
-
Posted in: Neighborhood
-
February 16, 2015 at 4:53 pm #150619
I found the following code to add to functions.php from woocommerce to change the “Select Options” button for variable product. I added to my functions php file and changed the text to “Buy Product” but nothing has changed. What am i doing wrong?
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 __( ‘Select options’, ‘woocommerce’ );
break;
default:
return __( ‘Read more’, ‘woocommerce’ );
}}
February 16, 2015 at 5:56 pm #150639Hi,
Please provide me wordpress admin login detail to check and resolve the issue.
ThanksFebruary 16, 2015 at 6:00 pm #150641This reply has been marked as private.February 17, 2015 at 1:39 pm #150880You have only changed the ‘external product’ type, you need to change the
case ‘variable': return __( ‘Select options’, ‘woocommerce’ );
part
– Kyle
February 17, 2015 at 2:08 pm #150901Hi,
I have resolved your issue through this code:-function sf_text_strings( $translated_text, $text, $domain ) { $translated_text = strtolower($translated_text); switch ( $translated_text ) { case 'select options' : $translated_text = __( 'Buy Product', 'woocommerce' ); break; } return $translated_text; } add_filter( 'gettext', 'sf_text_strings', 20, 3 );
Thanks
MohammadFebruary 17, 2015 at 3:23 pm #150959Hi mohammed
Thanks very much it works brilliantly.
And do you know how to get the same “Buy Product” button enabled on the mini products when you show best seller or latest products. I would like it to pop up even thought the product is tiny. Is this possible?
February 17, 2015 at 4:48 pm #150998Hi,
I am afraid that its not possible due to customization.
Thanks
MohammadFebruary 17, 2015 at 7:59 pm #151033ok thanks.
February 17, 2015 at 9:27 pm #151049I thought that the display of the wording “Select options” for variable mini products like bestsellers or new products was a translation error. Cant that be translated or what?
February 18, 2015 at 7:20 am #151115Hi,
Please attach a marked screenshot to explain this issue.
Thanks
MohammadFebruary 20, 2015 at 3:22 pm #151999The problem is for all media displays. Here is an image from a mobile. But the same error is also visible when viewing the site on a computer.
https://dl.dropboxusercontent.com/u/22182623/Foto%202015-02-20%2016%2018%2029.png
February 20, 2015 at 5:01 pm #152028Hi,
Please use this custom css code:-@media only screen and (max-width: 479px) { .woocommerce ul.products li.product figure figcaption{ display:none } .woocommerce ul.products li.product figure figcaption:hover{ display:block !important; } }
Thanks
MohammadFebruary 20, 2015 at 10:16 pm #152078Ok, you need to fix this also to the next update since it should pick the text string from the theme translation file.
Will your solution work on any media screen size?
February 21, 2015 at 1:18 pm #152149I knew you were going to misinterpret this just because I uploaded a photo from a mobile. The problem applies to all screen sizes regardless of the device used to view the website. You must solve this problem to the next update. This has not been a problem before. The wording “Select options” should be taken from the translation file and be like “Välj alternativ” in swedish. I do want some text to be displayed there, just the right one for my language. With the custom css provided above the text is removed.
February 21, 2015 at 1:29 pm #152151Hi,
I will inform to developer about this issue.
Thanks
Mohammad -
Posted in: Neighborhood
You must be logged in and have valid license to reply to this topic.