How to change “add to basket” button text in WooCommerce based on product category?

You’re going to want to filter the text. here’s the function from core WC that builds that text. In both of these instances $this will be the product.

/**
 * Get the add to cart button text for the single page.
 *
 * @access public
 * @return string
 */
public function single_add_to_cart_text() {
    return apply_filters( 'woocommerce_product_single_add_to_cart_text', $this->get_button_text() ? $this->get_button_text() : _x( 'Buy product', 'placeholder', 'woocommerce' ), $this );
}

/**
 * Get the add to cart button text.
 *
 * @access public
 * @return string
 */
public function add_to_cart_text() {
    return apply_filters( 'woocommerce_product_add_to_cart_text', $this->get_button_text() ? $this->get_button_text() : _x( 'Buy product', 'placeholder', 'woocommerce' ), $this );
}

So you’re going to want to add a filter to either woocommerce_product_single_add_to_cart_text or woocommerce_product_add_to_cart_text that checks if $this is an event and changes the text if it is or returns the default text if it isn’t.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)