To achieve something like this you should change the woocommerce_after_shop_loop_item
hook, which is where the add to cart button is added.
To replace it with custom behavior, first, you remove the button, then add your custom button in its place.
add_action( 'init', 'remove_add_to_cart_button' );
function remove_add_to_cart_button() {
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 );
}
add_action( 'woocommerce_after_shop_loop_item', 'new_add_to_cart_button' );
function new_add_to_cart_button() {
// Your button code.
}
You can find more about WooCommerce hooks here: https://docs.woocommerce.com/wc-apidocs/hook-docs.html.
Related Posts:
- Order by rating not works in wp_query
- Woocommerce: show default variation price is products list?
- Woocommerce checkout fields on the same line
- display available size on hover, in woocommerce shop page [closed]
- How to Add Product Variation with Multiple Images via WooCommerce REST API
- WooCommerce: Email Notifications
- How do you add custom metadata to WooCommerce orders? Specifically a second external order ID
- WooCommerce: Adding Order Item Meta Data That’s Hidden
- Woocommerce add_to_cart non-register visitor not working
- Redirect user after login through woocommerce login page to page with his/her username?
- WooCommerce restore stock on order cancel
- Woocoomerce product category count including subcategories
- Authenticate user into wordpress via 3rd party system, both with the same domain
- WordPress select field – show current value?
- Get the category ID in checkout page woocomerce
- “Cannot read property ‘replace’ of undefined” Javascript error when trying to add attribute terms from add product page [closed]
- Arranging Product Details on Shop Page
- How to get woocommerce subscription next payment date or date when subscription expires in woocommerce_subscription_renewal_payment_complete hook?
- WooCommerce product taxonomies and menu export
- Javascript / Ajax Error After Migrating To New Domain Name
- How can i stop woocommerce checkout event based on api request result?
- WordPress Twenty Seventeen header image size not responsive for mobile
- WooCommerce back-end very slow takes 10 seconds to load, slow queries
- Woocommerce custom meta fields, sort by date
- Display custom field without plugin in woocommerce
- How to output php between header and woocommerce container
- WooCommerce – How can I make single product gallery show two images on the slider at once?
- How to delete all customer user account that haven’t placed a single order?
- jquery.validation.js is not working in woocommerce checkout page form
- Hide the prefix before the price of the product [closed]
- Backend users list – add Woocommerce meta to table
- Delete cookie when changing url (when navigating away from specific page of website)
- multi-vender wooCommerce ability to separate products based on zip code [closed]
- Woocommerce hook on address field change [closed]
- Maintenance mode just for WooCommerce shop pages [closed]
- I want to run a script only once on a ‘thank you’ page
- search customers in front end by billing data
- Dropdown menu not displaying WordPress
- WooCommerce – Create multiple product tags via rest api endpoint
- WooCommerce which roles and capabilities control user login re-direct to Woo Account Page?
- how do i remove a woo-commerce widget?
- How can I convert woocommerce checkout fields in capital letters
- main menu hide woo commerce single products tittle
- Conditional action hook
- Sending Email upon registration
- Order by date on category dynamically – Woocommerce
- Woocomnerce Limit Purchase value before proceed checkout
- Add to cart – button should be disabled
- How To Customize The Product Page Template for a WooCommerce Custom Product Type Plugin [closed]
- Hide Add to Cart button on woocommerce Product description page of a particular product
- Options to develop a non-ecommerce catalog?
- wp_set_object_terms setting only first id from array
- I need to export all products and images but I don’t know which table the images are in
- Add only sku to product url woocoomerce
- What is better way to sync wp multisite woocommerce products
- Remove required from a custom field created from WooCommerce Checkout Field Editor plugin
- How to change status of woocommerce orders when post status is changed
- manage_shop_order_posts_custom_column() hook is Not working In Functions.php file in my WordPress active theme
- How to send woocommerce emails in multiple languages
- Displaying Woocommerce Product Attributes on single product page
- WooCommerce – Child Category wont show, but Parent does
- WooCommerce Simple Auctions add username to auction finished email
- How to hide a random text with a div tag using a class on product pages with a specific tag
- Missing variable options on add to cart form
- Woocommerce digital download not working – database error Cannot add or update a child row: a foreign key constraint fails [closed]
- when product out of stock single page show button notify woo-commerce
- WooCommerce , Auto cancel orders status from processing after X days
- Change WooCommerce Word “Product” to Another Word
- How does a WooCommerce site integrate with the existing real world customer members?
- Add username and password section in WooCommerce’s my account page
- Recently viewed products – Order by viewed
- How can i add product Accessories from front-end using custom php form?
- How to save order item custom attributes save into custom table
- Manually create an order with a product ID woocommerce
- How to filter result set in custom metaboxes?
- Product overlapping header
- How to import products to Woo Commerce given that WP All Import keeps timing out
- WooCommerce subscriptions give option of manual renewal on checkout [closed]
- How to hide / remove duplicated Woocommerce products from Shop page
- Change order status after checkout
- Is it safe to update an old site after backing it up and activating a child theme?
- How to add coupon expiry date into the followup emails?
- Disable Woocommerce main shop page, but not the product category archive pages
- Custom Woocommerce checkout filed yields a Json error when validating [closed]
- access Woo commerce | WordPress methods externally
- How to store ACF from product in user_meta?
- Woocommerce set single city to sell to
- Trying to link to a custom css file in a new folder
- eCommerce solution doesn’t want to display its shortcodes or any content where it’s set to [closed]
- How do I make a diagonal strikethrough on wordpress? [closed]
- Woocommerce – Remove ‘Buy Product’ Button from shop page [closed]
- Add woocommerce.css in template?
- Woocommerce – display all sold out products
- Woocommerce how to show most selling products by category
- AffiliateWP not calculating multiple quantities when using affwp_calc_referral_amount filter
- Hide a shipping method if cart total is higher than an amount
- error 500 in Back Office when using a woocommerce function in functions.php
- WordPress pointing animated GIF images with wrong file name upon upload (GIFs animation not working)
- How to update all products with same SKU prefixes when updating stock with CSV?
- What is the best and cheapest way to generate dashboards about conversions data and store users? [closed]