I am trying to translate add to cart button. I have 2 code snippets from woocommerce documentation here are they:
FOR SINGLE PRODUCT - THIS ONE WORKS
add_filter( 'woocommerce_product_single_add_to_cart_text',
'woo_custom_cart_button_text' ); // 2.1 +
function woo_custom_cart_button_text() {
return __( 'My Button Text', 'woocommerce' );
}
FOR PRODUCT ARCHIVE - NOT WORKING?
add_filter( 'woocommerce_product_add_to_cart_text',
'woo_archive_custom_cart_button_text' ); // 2.1 +
function woo_archive_custom_cart_button_text() {
return __( 'My Button Text', 'woocommerce' );
}
I dont know why this other is not working. Is there some fix. I am using DIVI wordpress theme. And also overwrote my loop archive addtocart.php so I can display quantity input. This is also snippet from woocommerce documentation.