Home Forums WoodMart support forum I want to add a dropdown variable switch For the Product archive and text switch

I want to add a dropdown variable switch For the Product archive and text switch

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #516645

    merejve
    Participant

    I want a text switch only For the Single Product page and a dropdown variable switch For the Product archive. The dropdown variable switch For the Product archive is working now. Now I need to modify my single product page. Here I need to add a text switch.

    Also, I want to change the “Add to Cart ” button text on the Product archive. I already apply this code:

    
    add_filter( 'woocommerce_dropdown_variation_attribute_options_html', 'filter_dropdown_option_html', 12, 2 );
    function filter_dropdown_option_html( $html, $args ) {
        $show_option_none_text = $args['show_option_none'] ? $args['show_option_none'] : __( 'Choose an option', 'woocommerce' );
        $show_option_none_html = '<option value="">' . esc_html( $show_option_none_text ) . '</option>';
    
        $html = str_replace($show_option_none_html, '', $html);
    
        return $html;
    }
    
    add_filter( 'woocommerce_product_add_to_cart_text' , 'custom_woocommerce_product_add_to_cart_text' );
    function custom_woocommerce_product_add_to_cart_text() {
        global $product;    
        $product_type = $product->product_type;  
        switch ( $product_type ) {
    case 'variable':
                return __( 'Köp', 'woocommerce' );
            break;
    }
    } 
    
    // Change add to cart text on single product page
    add_filter( 'woocommerce_product_single_add_to_cart_text', 'woocommerce_add_to_cart_button_text_single' ); 
    function woocommerce_add_to_cart_button_text_single() {
        return __( 'Köp', 'woocommerce' ); 
    }
    
    // Change add to cart text on product archives page
    add_filter( 'woocommerce_product_add_to_cart_text', 'woocommerce_add_to_cart_button_text_archives' );  
    function woocommerce_add_to_cart_button_text_archives() {
        return __( 'Köp', 'woocommerce' );
    }
    
    /* Change Add to Cart text on shop page */
    function custom_cart_button_Shop_Page( $text, $product ) {
        if( $product->is_type( 'variable' ) ){
            $text = __('Köp', 'woocommerce');
        }
        return $text;
    }
    add_filter( 'woocommerce_product_add_to_cart_text', 'custom_cart_button_Shop_Page', 9, 2 );

    But it’s not working. Please help me to slove it as soon as possible.

    Attachments:
    You must be logged in to view attached files.
    #516826

    merejve
    Participant

    I don’t like here a mini cart I would like to redirect it cart page. please help me to fix it,

    Attachments:
    You must be logged in to view attached files.
    #516836

    Luke Nielsen
    Keymaster

    Hello,

    The “Add to Cart” button text can be changed with the help of the loco Translate plugin, more details on how to use it are here: https://xtemos.com/docs-topic/translate-woodmart-theme-with-loco-translate/

    In order to make text swathes, navigate to Products -> Attributes and for each attribute enable the “Text swatch” option: https://take.ms/lBYMK

    Let me know if you have any questions.

    Kind Regards

    #516843

    merejve
    Participant

    You didn’t understand my question. I want a text switch only For the Single Product page and a dropdown variable switch For the Product archive. The dropdown variable switch For the Product archive is working now. Now I need to modify my single product page. Here I need to add a text switch.

    If I switch it to Text from here, then the dropdown of the product pages will change. I want to change just a single shop page. Not Product archive pages.

    One More, I don’t like here a mini cart I would like to redirect it cart page. please help me to fix it,

    Attachments:
    You must be logged in to view attached files.
    #517265

    Luke Nielsen
    Keymaster

    Hello,

    1. Sorry to say but right now there is no option in Theme Settings available for that. It requires Customization and this is beyond our limitations and support policy scope. Hope you can understand our limitations.

    2. Please navigate to the Header builder and disable the “Position” for the cart element here: https://take.ms/TMisH

    Let me know if you have any questions.

    Kind Regards

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