woocommerce_before_calculate_totals не работает с индивидуальным шаблоном продукта - PullRequest
1 голос
/ 14 октября 2019

После 2-3 дней разочарования и устранения неполадок я обнаружил вину: мои собственные шаблоны одного продукта. Я обнаружил, что если я удалил эти пользовательские шаблоны с пользовательскими форматами div и HTML - дизайн был поврежден, но желаемый результат был получен.

Моя главная проблема:
На основе " Опция пользовательского флажка продукта, которая изменяет цену товара в корзине Woocommerce " и отвечает на мой предыдущий вопрос, где дополнительная опция (флажок) может быть добавлена ​​к цене товара , но этоне добавляется к итогу на странице корзины.

Не работает ли woocommerce_before_calculate_totals хук с пользовательским single-product.php?

Что вызывает это? что может быть исправлением?

Custom Single-product.php отдыхает в mytheme/woocommerce/single-product.php здесь ниже:

<?php
    do_action( 'woocommerce_before_main_content' );
?>

<div class="wrap wrap2">

    <div class="fcontent whitebg wshadow">
        <div class="frow">
            <h1 class="italic"><?php the_title(); ?></h1>
            <img src="https://wptravelengine.com/wp-content/uploads/edd/2018/07/Stripe-Payment-1000x683.jpg" alt="">
        </div>
    </div><!-- content -->

    <div class="sidebar">
        <div class="sleft whitebg">
            <?php if(have_posts()): while(have_posts()): the_post(); ?>
                <?php the_content(); ?>
            <?php endwhile; endif;?>
        </div>
        <div class="sright">
            <div class="somethemname_addcart browser-compatible whitebg">
                <form action="" id="order">
                    <div class="bbuynow">
                        <div class="bbuynow_one">
                            <?php while ( have_posts() ) : the_post(); ?>
                            <?php
                            wc_get_template_part( 'content', 'single-product' );
                            ?>
                            <?php endwhile; // end of the loop. ?>          
                        </div>                          
                </form>
            </div>

            <div class="browser-compatible whitebg">
                <h6>Browser compatibility</h6>
                <div class="browsers">
                    <div><img width="50px" height="50px" src="<?php bloginfo('stylesheet_directory');?>/img/svg/browsers/chrome.svg" /></div>
                    <div><img width="50px" height="50px" src="<?php bloginfo('stylesheet_directory');?>/img/svg/browsers/edge.svg" /></div>
                    <div><img width="50px" height="50px" src="<?php bloginfo('stylesheet_directory');?>/img/svg/browsers/firefox.svg" /></div>
                    <div><img width="50px" height="50px" src="<?php bloginfo('stylesheet_directory');?>/img/svg/browsers/opera.svg" /></div>
                    <div><img width="50px" height="50px" src="<?php bloginfo('stylesheet_directory');?>/img/svg/browsers/safari.svg" /></div>
                    <div><img width="50px" height="50px" src="<?php bloginfo('stylesheet_directory');?>/img/svg/browsers/internet-explorer.svg" /></div>
                </div>
            </div>
            <div class="browser-compatible whitebg">
                <table class="prod-desc">
                    <caption></caption>
                    <tr>
                        <td>Last Updated</td>
                        <td>January 29 2019</td>
                    </tr>
                    <tr>
                        <td>Created</td>
                        <td>29 January 1206 B.C.</td>
                    </tr>
                    <tr>
                        <td>Compatible with</td>
                        <td>Woocommerce 3.X</td>
                    </tr>
                    <tr>
                        <td>Four</td>
                        <td>4</td>
                    </tr>
                    <tr>
                        <td>Five</td>
                        <td>5</td>
                    </tr>
                    <tr>
                        <td>Six</td>
                        <td>6</td>
                    </tr>
                    <tr>
                        <td>Seven</td>
                        <td>7</td>
                    </tr>
                </table>
            </div>
        </div>
    </div><!-- fcontent whitebg -->

    <!-- This was the area for the table-->

</div>



<?php
    do_action( 'woocommerce_after_main_content' );
    // do_action( 'woocommerce_sidebar' );
?>

Аналогично, content-single-product.php также отдыхает здесь → mytheme/woocommerce/content-single-product.php

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...