how to add custom button on product

I have created Custom Button using following Code at themes/package/woocommerce/single-product/add-to-cart/simple.php

<?php 
    if($_product->getCustom_button()){ //yes or no button
?>
    <button type="button" title="<?php echo $_product->getCustom_button_name() ;?>" class="btn btn-default" onclick="window.open('<?php echo $_product->getCustom_button_url() ;?>')"><span><span><i class="icon-desktop"></i><?php echo $_product->getCustom_button_name() ;?></span></span></button>
<?php } ?>

but this code is not work properly.
i want custom button work with product attributes.
enter image description here

2 Answers
2

add_action('woocommerce_after_add_to_cart_button','cmk_additional_button');
function cmk_additional_button() {
    echo '<button type="submit" class="button alt">Change me please</button>';
}

add this code in your Child theme functions.php

Try this code

Leave a Comment