I asked the question on stackoverflow and got the answered there. But what was the issues was that I used add_filter, had the wrong priority and used the wrong hook. The answer: https://stackoverflow.com/questions/68661105/remove-and-replace-woocommerce-add-to-cart-button
Related Posts:
- How many filter/action hooks are healthy?
- Filter specific shortcode output?
- Earliest hook to reliably get $post/$posts
- Where to hook into post content?
- What does (10, 2) mean when used with add_filter
- Clarification on filters and hooks
- Valid characters for actions, hooks and filters
- How to hook into unregistering a widget instance?
- How to check if a hook is hooked or not?
- What hook do I use to edit the post statuses option in admin?
- Filter hook before create order WooCommerce
- How to disable all WordPress emails modularly and programatically?
- How to add attribute to output with wp_video_shortcode add_filter
- How to change Woocommerce breadcrumbs content?
- Change text of Description in Image Library
- Load different template file when condition met?
- Am I using the right hook for removing quicktags on the admin TinyMCE?
- About Hooks and Filters
- How to enable visual editor when editing comments on the dashboard?
- Should I use add_action(‘publish_post or add_filter(‘publish_post?
- Please explain me what the do_action does
- Filter all html output
- Can’t get wp_title filter working in twenty sixteen child theme
- Removing labels and tag on WordPress’s default login form
- How to trigger the core WPLANG to make automatically set a language when the theme is activated? [duplicate]
- Too many actions/filters!
- How to get list of all hooks of current theme / plugin?
- Which hook is fired when inserting media into a post
- WordPress tag cloud add more links
- Why anything done on comments_array hook gets reset?
- add_filter() function misunderstanding
- Is it possible to track down Actions and Filters?
- Yoast SEO hooks overriding themselves
- add filter login_redirect does not contain original requested redirect
- get_header and hook avoid normal call
- Question about how do wordpress filters/actions work
- How to add numeric slug for child page in WordPress 5.9?
- Can the wp_filter object hold multiple values with the same key
- How to change the order (priority) of registered filters (or actions) (e.g. for the_content)?
- apply_filters/do_action tag characters limit
- Filter taxonomy admin pagination
- How to modify core when there is no hook?
- WP action/filter to modify title before header output and article output?
- Using wp_handle_upload() to Direct Specific Path by Using $overrides
- Post Content, Special Characters and Filters
- How to filter for user registration, be able to throw error message
- Gutenberg – Add align controls to a custom block
- How to remove action with slashes and arrows?
- Better extend a class or use add filter/action hooks?
- Add default user field to WooCommerce checkout [closed]
- Changing WordPress core without hacking core
- Customize title, description and focused keyword [closed]
- Plugin options, presets and filters : can you help me improve my workflow?
- how to customize rss feed tags using hooks?
- Filtering the post list in the admin area
- Woocommerce “added to cart” message on main(home) page
- How to check if a protected hook is hooked?
- Wrapping my head around add_filter
- Gutenberg Block – Post Featured Image Filter Hook
- Admin post list – adding an option to the date filter dropdown
- Modify message displayed on post save
- Change custom post type GUID in RSS
- Pass debug_backtrace() in WordPress filter
- filter hook to load a different post/page on current post/page
- Remove actions/filters that are set with create_function()
- Redirect to woocommerce checkout after adding to cart – item already in cart
- How to access page variable inside action hook
- I need to hook and change language of facebook sdk
- Use has_filter on comment_post
- How To Get Search Term and Use in Function
- Renaming wordpress login and get new password button
- Is this hook really deprecated? ( manage_{$taxonomy}_custom_column )
- Hook in a sidebar widget and add some markup
- Same URL for portfolio and for a page creates 404 error. Is there any filter that i can use for a child page?
- ‘manage_users_custom_column’ is a filter, but ‘manage_posts_custom_column’ is an action. Why?
- How do I add a line break to a string that is output by PHP?
- Scanning for custom embed and prefetching
- The gettext hook doesnt work on text with links
- Filter widget_posts_args not working
- Filter the title to only affect the_title() template function
- How can I filter the comment action links so that I can display the actions links based on user capabilities?
- Hook to change the site URL
- Modify WordPress Page Title ()
- Hook to add content after date in post?
- Is it possible to assign a css id to a row in plugins list table?
- Add Index to Item in WordPress Gallery
- Re-order search results with posts_orderby filter and post meta value
- Converting restricted html in comments to bbcode
- Why none of xmlrpc filters work
- How to add a class to Buddypress avatars in the Activity stream? [closed]
- Which hook should be used in this case?
- WooCommerce comments_template Filter Not Firing
- str_replace css meta tag?
- How to use apply_filters(‘get_calendar’) to change get_calendar() output?
- Better way to change the default password reset url with the woocommerce one?
- Hooking/Filtering theme name to add theme directory
- How to elect position of new item output in a dropdown when using add_filter
- Replacing text using add_filter
- Passing value from one hook to another
- Change password reqts with NO plugin without breaking resetpass link?