So I have a problem, if I want to add my “add-to-cart-button” in my content-single-product.php script; then I cant add Variation products anymore. But the normal products are still working…

I dont know what went wrong.

<?php if ($product->is_type( 'variable' ) ) {
    echo '<div class="card-content">
        <span>';
    echo '<div class="btn modal-trigger" href="#modal5">ello';
    echo '<div id="modal5" class="modal" style="overflow: auto;">
          <div class="modal-content">';
        /**
             * woocommerce_single_product_summary hook.
             *
             * @hooked woocommerce_template_single_title - 5
             * @hooked woocommerce_template_single_rating - 10
             * @hooked woocommerce_template_single_price - 10
             * @hooked woocommerce_template_single_excerpt - 20
             * @hooked woocommerce_template_single_add_to_cart - 30
             * @hooked woocommerce_template_single_meta - 40
             * @hooked woocommerce_template_single_sharing - 50
             */
            do_action( "woocommerce_single_product_summary" );
    echo '</div>';
    echo '</div>';
    echo '</div>';
    echo '</span>';

Full Code here: https://pastebin.com/NQNWGZGF

Read more here: How can I add my "Variation add to cart button" in a modal? Using Woocommerce


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: