bobbingwide / vgc

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

Add to cart enabled before customer has entered their post code. #69

Closed bobbingwide closed 10 months ago

bobbingwide commented 10 months ago

Since the solution for #59 has been delivered there's been a problem with the intercommunication between the original JavaScript code in addon-scripts.js and the new code in vgccodes.js

When a product has one or more optional upgrades which are mandatory, it's possible to enable the Add to cart button before the post code has been entered.

This may result in the product being added to the cart then later discovering it's not deliverable to the customer's address and also a Warning message

Scenario

  1. Display /store/swallow-kingfisher-6-x-8-ft-greenhouse/
  2. Click on "Choose from Wooden, Oiled & Painted Finishes*
  3. Choose Oiled +£318.00
  4. The Add to cart button is enabled.
  5. Click on Add to cart
  6. The product is added to the cart
  7. The Warning message is issued
[27-Nov-2023 15:41:09 UTC] PHP Warning:  Undefined array key "delivery" in 
C:\apache\htdocs\wordpress\wp-content\themes\vgc\inc\custom-woo-functions.php on line 54

Expected ouput

  1. Display /store/swallow-kingfisher-6-x-8-ft-greenhouse/
  2. Click on "Choose from Wooden, Oiled & Painted Finishes*
  3. Choose Oiled +£318.00
  4. The Add to cart button remains disabled until a valid post code has been entered.
  5. Enter valid post code eg PO9
  6. Add to cart button is enabled.
  7. Click on Add to cart
  8. The product is added to the cart
  9. No Warnng message is produced
bobbingwide commented 10 months ago

Delivered in v1.8.0. Output as expected. Though it's not possible to test that the Warning's not produced in live since WP_DEBUG constants aren't set.