Quantcast
Channel: WordPress.org Forums » All Topics
Viewing all articles
Browse latest Browse all 59525

can’t filter “add to cart” text when using shortcode

$
0
0

Replies: 0

I’m using the add_to_cart shortcode on a non-product page and everything is working fine, with one exception: I can’t change the text from the default “Add to Cart”. Elsewhere, I have used this filter:

add_filter('woocommerce_product_single_add_to_cart_text', 'woo_custom_cart_button_text');
function woo_custom_cart_button_text() {
$button_text = 'Submit payment';
return __($button_text, 'woocommerce');
}

This works fine for add_to_cart buttons on the products archive page and the individual product pages, but not for the button created with the shortcode. How can I change the text for the shortcode?


Viewing all articles
Browse latest Browse all 59525

Trending Articles