• So … i’ve created a function snippet in the function.php file:

    function wc_custom_single_addtocart_text( $text, $product ) {
        switch ( $product->product_type ) {
            case 'simple'  : $text = 'Simple product text'; break;
            case 'variable': $text = 'Variable product text'; break;
            case 'external': $text = 'External product text'; break;
            case 'grouped' : $text = 'Grouped product text'; break;
            default        : $text = 'Add to Cart'; break;
        }
    
        return $text;

    But I need something at the beginning that checks if they have a subscription.

    My goal is to have the add to cart button change to ‘view product’ when the user has an active subscription.

    https://wordpress.org/plugins/woocommerce/

Viewing 16 replies (of 16 total)
Viewing 16 replies (of 16 total)

The topic ‘Conditional Formatting’ is closed to new replies.