• jurijsmsk

    (@jurijsmsk)


    Hey,

    How to replace default botiga add to cart with custom button? I know about hooking it after and removing price, but it’s not an option.

    Doesn’t work with default woo hooks soo…

    function replace_add_to_cart_with_get_in_touch_button() {
    global $product;

    $product_ids = array(9183, 6760, 9883);

    if (in_array($product->get_id(), $product_ids)) {
    remove_action('woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30);
    add_action('woocommerce_single_product_summary', 'add_get_in_touch_button', 30);
    }
    }

    add_action('woocommerce_single_product_summary', 'replace_add_to_cart_with_get_in_touch_button', 1);

    function add_get_in_touch_button() {
    ?>
    <button class="get-in-touch-btn">Get in Touch</button>

    <div id="contact-form-modal" class="contact-modal">
    <div class="contact-modal-content">
    <span class="close-modal">&times;</span>
    <?php echo do_shortcode('[contact-form-xxx id="xxx" title="Get in Touch"]'); ?>
    </div>
    </div>
    <?php
    }
    • This topic was modified 2 months ago by jurijsmsk.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.