BLACK FRIDAY BIGGEST SALE EVER!! Use coupon code BF33 to get 33% discount on all our products. Enjoy!

alexanderbiscajin

Forum Replies Created

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • in reply to: Replace add to cart on shop page with link to product page #1332554

    alexanderbiscajin
    Participant

    First step you can do is to remove add to cart button using this code.

    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();
    }

    Reference: https://www.wpblog.com/add-to-cart-button-in-woocommerce-store/

    in reply to: Remove Cart Button #1332021

    alexanderbiscajin
    Participant

    You can use 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);
    
    }

    For reference you can see https://www.wpblog.com/add-to-cart-button-in-woocommerce-store/

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