Forums

Give help. Get help.

  • # February 9, 2013 at 6:47 pm

    I opened up these files to try and edit out the Add to cart button//
    add-to-cart.php and content-product.php
    But I am clueless on how to remove the php function so the button is no longer displayed on the main products page.
    I’d only like the button there when a customer is on the product’s single page…

    Can anyone help me find the correct file to remove the button?
    Please!

    # November 7, 2017 at 12:49 am

    Hide add to cart from shop page. You can add this code in woocommerce.php (located wp-content/plugins/woocommerce):

    `function WpBlog() {

    remove_action( ‘woocommerce_after_shop_loop_item’, ‘woocommerce_template_loop_add_to_cart’);

    remove_action( ‘woocommerce_single_product_summary’, ‘woocommerce_template_single_add_to_cart’);

    return WooCommerce::instance();

    }`

    And for the specific product pages add the code in functions.php

    `add_filter(‘woocommerce_is_purchasable’, ‘wpblog_specific_product’);

    function wpblog_specific_product($purchaseable_product_wpblog, $product)
    {
    return ($product->id == specific_product_id (512) ? false : $purchaseable_product_wpblog);

    }`

    # November 13, 2017 at 9:33 pm

    For reference you can view the details here : https://www.wpblog.com/add-to-cart-button-in-woocommerce-store/

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

You must be logged in to reply to this topic.

icon-anchoricon-closeicon-emailicon-linkicon-logo-staricon-menuicon-nav-guideicon-searchicon-staricon-tag