Product buttom

Support Forums Kampina Product buttom

Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
    Posts
  • #255
    gisele
    Participant

    I want to change the ” read more” from products buttom but i don’t know where i can do this

    #256
    TigriWeb
    Keymaster

    Hi Gisele,

    We use the woocommerce_loop_add_to_cart_link hook to modify the button. You can add the following function to functions.php, and it will override ours, because we wrap it with:
    if ( ! function_exists( 'kampina_woocommerce_loop_add_to_cart_link' ) ) :

    /**
     * Function for <code>woocommerce_loop_add_to_cart_link</code> filter-hook.
     *
     * @param string $html
     * @param object $product
     * @param array  $args
     *
     * @return string
     */
    function kampina_woocommerce_loop_add_to_cart_link( $html, $product, $args ) {
    	$button_text = $product->add_to_cart_text();
    	$svg_icons   = '<svg class="icon-arrow" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">
    		<path d="M15.691,8.703l-4,4c-0.375,0.406-1.031,0.406-1.406,0c-0.406-0.375-0.406-1.031,0-1.406l2.281-2.312H1.004c-0.562,0-1-0.438-1-1c0-0.594,0.438-1,1-1h11.563l-2.281-2.281c-0.406-0.375-0.406-1.031,0-1.406c0.375-0.406,1.031-0.406,1.406,0l4,4C16.098,7.672,16.098,8.328,15.691,8.703z" fill="currentColor"/>
    	</svg>';
    
    	switch ( $product->get_type() ) {
    		case 'simple':
    			$svg_icons .= '<svg class="icon-load" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">
    				<path d="M3,8c0-0.828-0.672-1.5-1.5-1.5S0,7.172,0,8s0.672,1.5,1.5,1.5S3,8.828,3,8z M3.403,1.903c-0.828,0-1.5,0.672-1.5,1.5s0.672,1.501,1.5,1.501s1.5-0.672,1.5-1.5S4.231,1.903,3.403,1.903z M3.403,11.097c-0.828,0-1.5,0.672-1.5,1.5s0.672,1.5,1.5,1.5s1.5-0.672,1.5-1.5S4.231,11.097,3.403,11.097z M8,13c-0.828,0-1.5,0.672-1.5,1.5S7.172,16,8,16s1.5-0.672,1.5-1.5S8.828,13,8,13z M14.5,6.5C13.672,6.5,13,7.172,13,8s0.672,1.5,1.5,1.5S16,8.828,16,8S15.328,6.5,14.5,6.5z M12.597,11.097c-0.828,0-1.5,0.672-1.5,1.5s0.672,1.5,1.5,1.5s1.5-0.672,1.5-1.5S13.425,11.097,12.597,11.097z M8,0C7.172,0,6.5,0.672,6.5,1.5S7.172,3,8,3s1.5-0.672,1.5-1.5S8.828,0,8,0z" fill="currentColor"/>
    			</svg>';
    			$svg_icons .= '<svg class="icon-check" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">
    				<path d="M5.033,13.986L5.033,13.986c-0.267-0.001-0.526-0.103-0.715-0.292L0.295,9.671c-0.393-0.393-0.393-1.029,0-1.422c0.393-0.393,1.029-0.393,1.422,0l3.312,3.313l9.254-9.253c0.393-0.393,1.029-0.393,1.422,0c0.393,0.393,0.393,1.029,0,1.422l-9.958,9.957C5.559,13.876,5.299,13.986,5.033,13.986z" fill="currentColor"/>
    			</svg>';
    			break;
    
    		case 'variable':
    			$button_text = apply_filters( 'woocommerce_product_add_to_cart_text', $product->is_purchasable() ? __( 'Check Availability', 'kampina' ) : __( 'Read more', 'kampina' ), $product );
    			break;
    	}
    
    	$html = sprintf(
    		'<a href="%s" data-quantity="%s" class="%s" %s>%s%s</a>',
    		esc_url( $product->add_to_cart_url() ),
    		esc_attr( isset( $args['quantity'] ) ? $args['quantity'] : 1 ),
    		esc_attr( isset( $args['class'] ) ? $args['class'] : 'button' ),
    		isset( $args['attributes'] ) ? wc_implode_html_attributes( $args['attributes'] ) : '',
    		esc_html( $button_text ),
    		wp_kses( $svg_icons, 'kampina-svg' )
    	);
    
    	return $html;
    }

    Best Regards,
    TigriWeb Team

    #257
    gisele
    Participant

    but where i can put this code?

    #258
    gisele
    Participant

    I want to edit the “read more” to “leia mais” but I can’t understand how

    #259
    TigriWeb
    Keymaster

    If you only need to translate the button text, you can use the Loco Translate plugin by following the guide below:
    How to translate themes and plugins using Loco Translate

    Best Regards,
    TigriWeb Team

    #260
    gisele
    Participant

    the loco Plugin didn’t work with those buttons

    #261
    TigriWeb
    Keymaster

    Could you create a user “administrator” and send access to the admin panel to the email – tw-dev@tigriweb.dev ?

    Best regards,
    TigriWeb Team

    #262
    gisele
    Participant

    done

    #263
    TigriWeb
    Keymaster

    What URL do you use for login? /wp-admin shows “Not acceptable” error.

    Best regards,
    TigriWeb Team

    #264
    gisele
    Participant

    I need to translate this and all the things like ” related products” and “overview” and in the same time i need a second language in the website… do you know if thats possible with loko?

    #265
    TigriWeb
    Keymaster

    I can’t log in to your website.

    What URL do you use for login? /wp-admin shows “Not acceptable” error.

    Best regards,
    TigriWeb Team

    #266
    gisele
    Participant
    #267
    TigriWeb
    Keymaster

    I can’t log in to your website: https://prnt.sc/d6zWHCiU-3Rg.

    Perhaps you have other IP addresses blocked.

    Best regards,
    TigriWeb Team

    #268
    gisele
    Participant

    OK. So I think I will try another way. I will let the button invisible but i need to delete the other things. the “Overview” in the product and the “related products”. can I do this?

    #269
    TigriWeb
    Keymaster

    To remove related products, you need to add the following code to functions.php via FTP:
    remove_action( 'kampina_content_after', 'kampina_woocommerce_output_related_products', 10 );

    Alternatively, you can hide them using the following CSS, which you can add via
    Appearance → Customize → Additional CSS:

    .single-product .product .entry-summary + .product_tab-title,
    .single-product .related-products {
    	display: none;
    }

    Best regards,
    TigriWeb Team

Viewing 15 posts - 1 through 15 (of 15 total)
  • You must be logged in to reply to this topic.