• I have two almost identical sites, one being a development version of the other.

    For a few odd reasons, we hadn’t updated woocommerce on the live site for a while, but I just updated to 3.2.3. The dev site was always updated to make sure things work.

    Instead of WC products, we use wordpress posts for products with the “Add to cart” button code on there.

    Before the update on the live site, whenever you click “Add to cart” a check mark would appear next to the button with a “View cart” link to go to the cart.

    It still does this on the dev site (WC 3.2.3) but it no longer does it on the live site after updating.

    I checked all settings and googled and cannot get it to show on the updated live site.

    Can anyone help? Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support RK a11n

    (@riaanknoetze)

    What ends up happening on the live site – is it redirecting to the cart page or are you seeing an error?

    Thread Starter scottl31

    (@scottl31)

    It would appear that nothing happened, but the item would be added to the cart. So temporarily, I set it to automatic redirect to the cart.

    But I fixed this by breaking something else. We have a few items that are not yet for sale, so the button says “read more”. We don’t like that so I had this code that was changing the button to “not for sale”. This is the code:

    /*
    * replace read more buttons for out of stock items
    **/

    if (!function_exists(‘woocommerce_template_loop_add_to_cart’)) {

    function woocommerce_template_loop_add_to_cart() {

    global $product;

    if (!$product->is_in_stock()) {

    echo ‘Not For Sale‘;

    }

    else

    {

    woocommerce_get_template(‘loop/add-to-cart.php’);

    }

    }

    }

    For some reason this code was not working anymore. Then I found that removing this code made the “view cart” check mark thing work again.

    That’s GREAT! But I still need my “Read more” button to say “not for sale.”

    So, now do you know of the proper code that will replace the code above and do what I need?

    Thanks!
    Scott

    Caleb Burks

    (@icaleb)

    Automattic Happiness Engineer

    Here are two functions I wrote recently to change the add to cart text and urls: https://gist.github.com/WPprodigy/11769a6104b663a2fe609321e00fdd0b that could help get you pointed in the right direction.

    You could also use the woocommerce_loop_add_to_cart_link filter to override the whole section: https://github.com/woocommerce/woocommerce/blob/21e51b9fc6a9537366cbd5ca8275ec40eacd8e61/templates/loop/add-to-cart.php#L25

    Thread Starter scottl31

    (@scottl31)

    Caleb,
    It sort of works. Don’t mean to complain, but the first one just changes the text on ALL buttons on the site while leaving their functionality the same.

    I was hoping to have a change ONLY to the “read more” button that you get when the item is out of stock. That’s what the code I pasted above used to do. It just put the words “Not for sale” in place of the button and it was not clickable.

    Is there any chance that code could be updated? I was using it in 2.2 and I’m guessing that a version since then broke it.

    Thanks,
    Scott

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Item added to cart confirmation not showing anymore.’ is closed to new replies.