-1

I'm using motta theme for WooCommerce, and i don't like their add to cart button, it's too big, i want it to be so simple like a plus button, can you guys help me?

I tried to add many suggested codes in my functions.php file but they didn't work.

1 Answer 1

-1

You can add custom PHP code to your child theme’s functions.php file

    // Add custom Add to Cart button
add_filter('woocommerce_loop_add_to_cart_link', 'custom_add_to_cart_button', 10, 2);
function custom_add_to_cart_button($button, $product) {
    if ( $product->is_type( 'simple' ) ) {
        $url = $product->add_to_cart_url();
        $label = $product->add_to_cart_text();
        $button = '<a href="' . esc_url( $url ) . '" data-quantity="1" class="button custom-add-to-cart-button" data-product_id="' . $product->get_id() . '" aria-label="' . $label . '" rel="nofollow">' . $label . '</a>';
    }
    return $button;
}

Not the answer you're looking for? Browse other questions tagged or ask your own question.