This topic has 3 replies, 2 voices, and was last updated 9 years by sharmstr.

  • Author
  • #53932
     michalzwierz
    Participant

    Hi, is there an option to have ANOTHER (duplicated) “add to cart” button centered below detailed description?

    #54100
     sharmstr
    Moderator

    Here’s some code I came up with that will filter the description and append the add-to-cart shortcode.

    COPY CODE
    
    add_filter('the_content','append_add_to_cart');
    
    function append_add_to_cart( ) {
    	if ( is_single() && get_post_type( get_the_ID() ) == 'product' ) {
    		$content = get_the_content();
    		return $content . do_shortcode('[add_to_cart id="' . get_the_ID(). '"]');
    	}
    }
    
    

    That shortcode doesnt give you a qty box. You should ask over on the woo forums how to do this better.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    This support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com

    #55269
     michalzwierz
    Participant

    I understand how this thing works but, two questions:
    1. Where do I put it? When added to functions.php – breaks my website…
    2. Does the shortcode looks like this now: [add_to_cart]?
    Thank You!

    #55270
     sharmstr
    Moderator

    You put it in functions.php. It doesnt break my site. Maybe you copied it wrong. I dont understand your second question. Perhaps you’re better off asking over on the woocommerce forum since you wont be touching any kleo code to add it.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    This support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com

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

The forum ‘Plugins questions’ is closed to new topics and replies.

Log in with your credentials

Forgot your details?