Need help changing add to cart button
-
I need to change the add to cart button for 3 categories and one subcategory. I have it working for the categories, but it does not affect the one subcategory. Been stuck on this for days and can’t seem to make it work without breaking something. Acrylics is the only one that is a subcategory and the only one whose button has not changed. What am I missing? What I have now:
add_filter( 'woocommerce_loop_add_to_cart_link', 'replacing_add_to_cart_button', 10, 2 ); function replacing_add_to_cart_button( $button, $product ) { if( is_product_category( array( 'home-tanning-beds', 'commercial-tanning-beds', 'therapy-tanning-beds', 'acrylics'))) { $button_text = __("Buy Now", "woocommerce"); $button = '<a class="fusion-button button-3d fusion-button-pill button-medium button-default button-1" href="' . $product->get_permalink() . '">' . $button_text . '</a>'; return $button; } else do_action( 'woocommerce_add_to_cart', 'action_woocommerce_add_to_cart', 10, 3 ); $button_text = __("Add To Cart", "woocommerce"); $add_button = '<a class="fusion-button button-3d fusion-button-pill button-medium button-default button-1" href="'. $product->add_to_cart_url() .' ">' . $button_text . '</a>'; return $add_button; {
Any help is greatly appreciated.
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Need help changing add to cart button’ is closed to new replies.