Digital experiences for all disciplines
New Landing › How can we help? › Themeforest Theme Support › Neighborhood › WooCommerce native text hook for "add to cart" or "configure" text
New Landing › How can we help? › Themeforest Theme Support › Neighborhood › WooCommerce native text hook for "add to cart" or "configure" text
- This topic has 36 replies, 5 voices, and was last updated 8 years by David Martin – Support.
-
Posted in: Neighborhood
-
May 16, 2016 at 10:10 am #267663
Hi,
I have figured out that the theme doesn’t use the native Woocommerce text hooks for i.e. the “add to cart” text.
I have products with variations, but the variations were added through an extra plugin. If I now see my shop overview, normally the “add to cart” text will change to “choose” or “configure”, if a product has variations. At the moment, it doesn’t. Is there a way to use the native Woocommerce text option for that? What do I have to change to get that result? Thanks in advance
Best
MartinMay 16, 2016 at 11:49 am #267704Hi,
Please use this plugin https://wordpress.org/plugins/real-time-find-and-replace/ to change the text as you want.
Thanks
MohammadMay 16, 2016 at 12:21 pm #267718Hi Mohammad,
thanks for trying to help. Actually I am looking for the thing I have to change in the theme, to get my desired result. The plugin you have posted is surely the right one to find the different segments, but I don´t have the coding knowledge, to find the thing which I have to change in the theme. That´s why I asked what do I have to change to get that result? Thanks in advance.
warm regards
MartinMay 16, 2016 at 7:54 pm #267885Hi,
If our translations are overriding the Woocommerce ones in specific places you just need to translate those strings in the theme translations files.
Check this general documentation about translation
http://neighborhood.swiftideas.com/documentation/#translation-Rui
May 16, 2016 at 8:19 pm #267891Hi Rui,
Thanks for your response. It’s not a translation issue. For that cases I use WPML, which guides me through the different strings.
I have the problem that the “add to cart” text won’t change, if I have variable instead of regular products. Actually it shall change to anything like “configure” or so. In that case, the client knows that he has to choose different options before he can add the product to the cart.
At the moment the “add to cart” text will stay the same, even if I have a variable product.
This is a problem which I can solve via an extra options plugin, but in that case, I need the native woo commerce rules. I figured out, that the theme uses other hooks. I hope I could explain the problem a bit better. It is hard for me to describe such a complex issue in English. Thanks for your help.
Warm regards
MartinMay 18, 2016 at 5:56 pm #268484ok. thanks for the explanation.
In that case it should say “Select options” like in our demo
https://www.dropbox.com/s/wusbz37pcwo1w7u/Screenshot%202016-05-18%2018.00.45.png?dl=0But in the product page will say Add to cart but the button is inactive while you don’t select the product attributes in the dropdown.
https://www.dropbox.com/s/pbsiyhwig62dtbf/Screenshot%202016-05-18%2018.01.35.png?dl=0
Can you provide me a link to a variable product and will also need admin credentials to look at that product settings.
Use the private reply.-Rui
May 18, 2016 at 6:47 pm #268495This reply has been marked as private.May 20, 2016 at 3:45 pm #269087Hi,
These are the strings ready for translate in that add to cart section.
https://www.dropbox.com/s/hdosqgmumtrsar2/Screenshot%202016-05-20%2015.50.26.png?dl=0I didn’t understood exactly what appears with the Twenty 16 and not with Neighborhood, if you can provide an image to compare the difference to the current product page that would be great.
-Rui
May 22, 2016 at 9:39 am #269202Hi Rui,
thanks for your response. I have deinstalled the Twentysixteen theme, so I can´t show you some examples via screenshot. What I am trying to explain is, that the theme does use other strings than the current version of WooCommerce.
Here is the answer of the developer.
——————————————–
The screenshot is correct. This is what the theme is using. The problem is that those filters you see are not being used by WooCommerce.
WooCommerce on its last version 2.5x uses the following (which you can see by looking at its files):
\woocommerce\includes\abstracts\abstract-wc-product.php:
` /**
* Get the add to cart button text.
*
* @return string
*/
public function add_to_cart_text() {
return apply_filters( ‘woocommerce_product_add_to_cart_text’, __( ‘Read more’, ‘woocommerce’ ), $this );
}`\woocommerce\includes\class-wc-product-grouped.php:
/**
* Get the add to cart button text.
*
* @access public
* @return string
*/
public function add_to_cart_text() {
return apply_filters( ‘woocommerce_product_add_to_cart_text’, __( ‘View products’, ‘woocommerce’ ), $this );
}\woocommerce\includes\class-wc-product-simple.php:
/**
* Get the add to cart button text.
*
* @return string
*/
public function add_to_cart_text() {
$text = $this->is_purchasable() && $this->is_in_stock() ? __( ‘Add to cart’, ‘woocommerce’ ) : __( ‘Read More’, ‘woocommerce’ );return apply_filters( ‘woocommerce_product_add_to_cart_text’, $text, $this );
}\woocommerce\includes\class-wc-product-variable.php:
/**
* Get the add to cart button text.
*
* @access public
* @return string
*/
public function add_to_cart_text() {
return apply_filters( ‘woocommerce_product_add_to_cart_text’, __( ‘Select options’, ‘woocommerce’ ), $this );
}\woocommerce\includes\class-wc-product-variation.php:
` /**
* Get the add to cart button text.
*
* @return string
*/
public function add_to_cart_text() {
$text = $this->is_purchasable() && $this->is_in_stock() ? __( ‘Add to cart’, ‘woocommerce’ ) : __( ‘Read More’, ‘woocommerce’ );return apply_filters( ‘woocommerce_product_add_to_cart_text’, $text, $this );
}`
You can also see the WooCommerce documentation at https://docs.woothemes.com/document/change-add-to-cart-button-text/#section-2 (Change the add to cart text on product archives)
Note that the filter I’m talking about woocommerce_product_add_to_cart_text is what it should be use on WooCommere 2.1+ as indicated at the official WooCommerce documentation.
——————————————–
Thanks in advance for your help.
Best regards
MartinMay 23, 2016 at 2:16 pm #269434In that case will forward to our head developer.
Let’s wait for the reply.-Rui
May 23, 2016 at 7:04 pm #269559Ok…Thank you Rui…
Looking forward to hear from you…May 24, 2016 at 10:38 am #269670no problem. Let’s wait for the reply.
-Rui
May 24, 2016 at 9:02 pm #269857Thanks for the heads up on this – I’m gonna get this resolved for the next update.
– Ed
May 25, 2016 at 11:51 am #270014Hi Ed,
that sounds great. I am really happy that you will solve this with an update.
Also a big thanks to Rui, which was very patient regarding my bad English and explanation.
I am looking forward to the update.
Best regards
MartinMay 25, 2016 at 11:55 am #270017No problem with that,we are here to help. Thanks for the kind words.
Thanks Ed.-Rui
-
Posted in: Neighborhood
You must be logged in to reply to this topic.