New Landing How can we help? Themeforest Theme Support Neighborhood Change "Select Options" button for variable products

Viewing 15 posts - 1 through 15 (of 15 total)
  • #150619
    veruschia
    Member
    Post count: 29

    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’ );
    }

    }

    #150639
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    Please provide me wordpress admin login detail to check and resolve the issue.
    Thanks

    #150641
    veruschia
    Member
    Post count: 29
    This reply has been marked as private.
    #150880
    Kyle – SUPPORT
    Moderator
    Post count: 35880

    You have only changed the ‘external product’ type, you need to change the

    case ‘variable':
    return __( ‘Select options’, ‘woocommerce’ );

    part

    – Kyle

    #150901
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    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
    Mohammad

    #150959
    veruschia
    Member
    Post count: 29

    Hi 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?

    #150998
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    I am afraid that its not possible due to customization.
    Thanks
    Mohammad

    #151033
    veruschia
    Member
    Post count: 29

    ok thanks.

    #151049
    ehandelsfabriken
    Member
    Post count: 85

    I 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?

    #151115
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    Please attach a marked screenshot to explain this issue.
    Thanks
    Mohammad

    #151999
    ehandelsfabriken
    Member
    Post count: 85

    The 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

    #152028
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    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
    Mohammad

    #152078
    ehandelsfabriken
    Member
    Post count: 85

    Ok, 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?

    #152149
    ehandelsfabriken
    Member
    Post count: 85

    I 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.

    #152151
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    I will inform to developer about this issue.
    Thanks
    Mohammad

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

You must be logged in and have valid license to reply to this topic.

License required for one of the following items
Login and Registration Log in · Register