bobbingwide / vgc

VGC - Garden Vista Group theme
GNU General Public License v2.0
0 stars 0 forks source link

Cannot add items to cart with iOS devices #72

Closed bobbingwide closed 10 months ago

bobbingwide commented 10 months ago

Reported in an email. "website do not seems to be compatible with IOS- apple, iPhone devices, in some products cart is not totaling up and cart is not loading to into basket. We dont have problems with windows and Android."

I checked with my iPhone 13 mini for https://gardenvista.co.uk/store/shedlands-heavy-duty-pent-shed-2-3/

IMG_4705

bobbingwide commented 10 months ago

The problem also occurs with my iPad Air running iOS 12.5.7 iPad 13 mini is now running iOS 17.1.2

The problem does not occur in my Windows development environment with

bobbingwide commented 10 months ago

The problem does not occur with Building Removal

The Installation section is addon-select-required, so it gets added to the cart as soon as the page is loaded.

The HTML for FREE UK INSTALLATION is

<div class="addon-details">
<p class="fw-bold mb-0 addon-name">FREE UK INSTALLATION</p>
<div class="addon-price d-flex pb-4">
<div>FREE</div>
<div class="price" style="opacity: 0">
0
</div>
</div>
<label for="size" class="checkbox-container">
<input type="checkbox" onclick="addAddonToCart(event, 'checkbox')" name="installation" value="yes" checked="" disabled="">
<span class="checkmark"></span>
</label>
</div>
bobbingwide commented 10 months ago

The code that would appear to be not working is in https://github.com/bobbingwide/vgc/blob/master/inc/js/addon-scripts.js

function getVisibleAddonPrice( startNode ) {
  var prices = startNode.querySelectorAll('.addon-price .price');
  //console.log( prices );
  var price = null;
  for (let i = 0; i < prices.length; i++) {
    if ( isNotDeliveryPrice( prices[i] ) || !isHidden( prices[i] )) {
      price = prices[i].innerText;
      //console.log( price);
      price = parseFloat( price).toFixed( 2 );
    }
  }
  if ( price === null ) {
    //console.log( "No visible price!" );
    //console.log( startNode );
  }
  return price;
}

It would appear that the function is returning a price of null or NaN. I can't debug since I don't have the right equipment. I don't even know how to look at a console log on my iPhone / iPad. Help required.

bobbingwide commented 10 months ago

I'm trying a fix that sets the price from textContent rather than innerText.

Product Installation cost iPhone
https://gardenvista.co.uk/store/shedlands-heavy-duty-pent-shed-2-3/ 0 0
https://gardenvista.co.uk/store/robinsons-redcliffe-15-x-12-ft-ivory-greenhouse/ 0 0
https://gardenvista.co.uk/store/deponti-bosco-veranda-4060x2500mm/ 0 Price on enquiry 0
bobbingwide commented 10 months ago

Delivered in v1.8.1