• Resolved bondweb

    (@bondweb)


    Hi Guys I’m trying to insert a condition in single-product meta.php file. I’m trying this script

    function conditional_link() {
    
    	global $post, $product;
        $categ = $product->get_categories();
        
        if ( $categ = "Stampanti 3D") {
    	$z = 'PREVENTIVO';
        echo '<div><a href="https://www.mario.it"><button type="button" class="btn" id="single-quote">'. $z; '</button></a></div>'; 
    } else {
        echo '<div><a href="https://www.luigi.it"><button type="button" class="btn" id="single-quote">'. $z; '</button></a></div>';
    }
    }
    
    add_action( 'woocommerce_product_meta_end', 'conditional_link', 15 );

    but it doesn’t works. Can anyone help me? Please
    thanks in advance

    • This topic was modified 5 years ago by bondweb.
    • This topic was modified 5 years ago by bondweb.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Phil

    (@fullysupportedphil)

    Automattic Happiness Engineer

    Hey @bondweb

    You may want to try asking this question in the WooCommerce Developer Slack, as it’s better suited for getting development advice.

    You may get answers from other members of the community team here, however our support team isn’t able to help with customizations.

    I hope that advice helps and best of luck with this!

    Plugin Support con

    (@conschneider)

    Engineer

    Hi there,

    We haven’t heard back from you in a while, so I’m going to mark this as resolved – if you have any further questions, you can start a new thread.

    Kind regards,

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Conditional button in meta.php file’ is closed to new replies.