Navigation
This is archived content. Visit our new forum.
  • Author
    Posts
  • #20621

    David K
    Participant

    Hi. I have been trying to add html to appear after the Add to Cart button and trying all sorts of things (that I really don’t know anything about), in order to do so. It appears to me that the x theme is overriding some of the woocommerce plugin files.

    Could you please tell me how I would go about finding the add to cart button code and how I could add some html (a couple of links and an small image) right after the button in the outputted html?

    I can style it in CSS if I can get it to show up. But so far I have not gotten anywhere.

    ps. I have been trying to modify the add-to-cart.php file and placing this in my theme file under woocommerce –> loop and also under woocommerce –> themes –> loop. but absolutly nothing is happening.

    Thanks for your help.

    -DK

    ps. this is important to me because I want to add privacy policy, visa card acceptance and terms and condition links right by the button to help with the click through process.

    #20833

    Christian
    Moderator

    Hey David,

    Thanks for writing in. We’d love to help you with that but unfortunately your request is quite advanced and falls beyond our scope of support.

    You can take a look however of WooCommerce template structure and how to override them here.

    Hope that helps. 🙂

    #20949

    David K
    Participant

    That actually was very helpful. It answered a big question.

    Could you please point me into the right direction as to which .php file has this button code? I am not asking for you to code it for me. Just where I can find the code. I have been looking and can’t find it.

    Thanks.

    -DK

    #21124

    Kory
    Keymaster

    Hey David,

    Thanks for writing in! Depending on where you’re trying to edit the button, there are a few templates you can look to. Some of these might be overwritten in the theme, some might still be in the plugin. Either way, you can overwrite them by putting them at the right path in your child theme.

    The following templates are where you’ll want to look (relative to the plugin):

    1. /woocommerce/templates/single-product/add-to-cart/external.php
    2. /woocommerce/templates/single-product/add-to-cart/grouped.php
    3. /woocommerce/templates/single-product/add-to-cart/simple.php
    4. /woocommerce/templates/single-product/add-to-cart/variable.php

    The variable.php template mentioned above is overwritten in the theme at /x/woocommerce/single-product/add-to-cart/variable.php, so you’ll want to copy that over to your child theme to edit it if you want. To do so (or to edit any of the other files above), if you were using Integrity Light for example, it would look something like /x-child-integrity-light/woocommerce/single-product/add-to-cart/variable.php as the correct path.

    Thanks!