After 2-3 days of frustration and troubleshooting, I found the guilty: my custom single product templates. I found If I removed those custom templates with custom div and HTML arrangements - the design was broken, but the desired output was coming.
My main issue:
Based on "Product custom checkbox option that changes Woocommerce cart item price" annswer to my previous question, where an extra option (checkbox) can be added to item price, but it's is not adding to the total on cart page.
Is woocommerce_before_calculate_totals
hook doesn't work with custom single-product.php
?
What is causing this? what can be the fix?
Custom Single-product.php
resting in mytheme/woocommerce/single-product.php
here below:
<?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' );
?>
Similarly, content-single-product.php
also is resting here →
mytheme/woocommerce/content-single-product.php