New Landing How can we help? Themeforest Theme Support Dante Add to shopping bag text

Viewing 7 posts - 1 through 7 (of 7 total)
  • Posted in: Dante
  • #104924
    Pothe
    Member
    Post count: 336

    Hi
    I’ve tried to edit the add-to-cart.php to edit the “Add to shopping bag” text on the button.
    But it’s not working.

    Any other way to do this ?

    thanks

    #104926
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    Add the following to your functions.php file.

    add_filter( 'add_to_cart_text', 'woo_custom_cart_button_text' ); // < 2.1
    add_filter( 'woocommerce_product_add_to_cart_text', 'woo_custom_cart_button_text' ); // 2.1 +
    function woo_custom_cart_button_text() {
    return __( 'My Button Text', 'woocommerce' );
    }

    Thanks

    #104930
    Pothe
    Member
    Post count: 336

    Thanks Mohammad,
    I tried this before and it’s not working.
    Not sure why it’s not changing.

    #105144
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    Please try this code:-
    function sf_text_strings( $translated_text, $text, $domain ) {
    switch ( $translated_text ) {
    case ‘Add to shopping bag’ :
    $translated_text = __( ‘Your text’, ‘woocommerce’ );
    break;
    }
    return $translated_text;
    }
    add_filter( ‘gettext’, ‘sf_text_strings’, 20, 3 );

    #109941
    MHC
    Member
    Post count: 247

    Hi Mohammad,

    I tried to add the above codes to my function.php file. The first one doesn’t work, and the second one is causing error message (attached screenshot).

    Thank you.

    Attachments:
    You must be logged in to view attached files.
    #109953
    MHC
    Member
    Post count: 247

    Hi Mohammad,

    Nevermind.
    I successfully changed the text by following this thred:
    http://support.swiftideas.net/forums/topic/few-issues-catalog-imagesadd-to-shopping-bagbuy-button/

    Thank you very much!

    #109976
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    You most welcome. I’m glad that issue resolved.
    Thanks 🙂
    With Best Regards
    Mohammad

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.