Your Location is: Home > Php

How i can change default add to cart button in WooCommerce?

From: Belgrade View: 2346 BeeWay Inc 


This is how it all looks

I want to add a new "add_to_cart" button template for the outer product card without affecting the inner one. but when I add, the old one remains. What's wrong with my code?

it is my code in functions.php

function loop_custom_variable_products() {
    global $product;
    remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_price', 30 ); // Remove price
    remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 30); // remove add to cart
    remove_action( 'woocommerce_after_shop_loop_item', 'loop_variations_custom_buttons_and_prices', 30 ); // Add prices with custom buttons
add_action( 'init', 'loop_custom_variable_products' );
add_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_variable_add_to_cart1', 30 );
//add_action( 'woocommerce_after_shop_loop_item', 'woocommerce_variable_add_to_cart1', 30);
function woocommerce_variable_add_to_cart1(){
   //... some code for new add to card style

Best answer