bobbingwide / vgc

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

Post code related options for UK delivery, installation, removal and base #59

Open bobbingwide opened 1 year ago

bobbingwide commented 1 year ago

There are several challenges to address related to delivery, installation, removal and base.

Delivery options

Options - including Installation, removal and base

bobbingwide commented 1 year ago

select p.post_title, m.post_id, m.meta_key, m.meta_value from vgcwp_postmeta m , vgcwp_posts p where m.post_id = p.ID and p.post_type = 'brands' and meta_key in ( 'postcodes_excluded', 'delivery_cost', 'delivery_cost_band_1', 'delivery_cost_band_2', 'delivery_cost_band_3', 'delivery_cost_band_4', 'installation_cost_override', 'offer_base_options' ) order by meta_key, post_title;

bobbingwide commented 1 year ago

Here's a summary of the Brands data, produced in Excel from the output of a query similar to above.

image

bobbingwide commented 1 year ago

Notes from our meeting on Wed am14th June.

bobbingwide commented 1 year ago

Passmores and Regency have delivery charges depending on the band assigned to the delivery post code

If the post code is not in one of the 4 bands, then delivery is not supported.

bobbingwide commented 1 year ago

I've investigated what happens if the logic to display the options is displayed without regard to the post code. I did this without changing any of the logic that checks the post code; I just moved it to earlier in the template.

This is because the View Options button submits a different request ( form action=#options_area method=post ) rather than the form submitted for Add to cart ( form method=post id=select-addons. )

It might be possible to change the code to say "Please confirm your post code before selecting your options", but this might not be a better experience for the user compared to the current.

One alternative is to

bobbingwide commented 1 year ago

Note: With the current logic, when the post code is not supported, the Current Cart is displayed but the Add to cart button isn't disabled.

Pedantic note: It's not really the current cart, it's the current selection for this viewing of the product. The current cart is displayed when viewing /cart/

image

bobbingwide commented 1 year ago

Re: post code bands

Band Codes
1 GU5 GU7 GU8 GU26 GU27 GU28 GU29 GU30 GU31 GU32 GU33 GU35
2 GU1 GU2 GU3 GU4 GU7 GU9 GU10 GU11 GU12 GU14 GU34 GU51 GU52 PO1 PO2 PO3 PO4 PO5 PO6 PO7 PO8 PO9 PO10 PO14 PO15 PO16 PO17 PO18 PO19 PO20 RH14 RH20
3 GU6 GU15 GU16 GU17 GU18 GU19 GU20 GU21 GU22 GU23 GU24 GU46 GU47 PO11 PO12 PO13 PO21 PO22 RG21 RG22 RG23 RG24 RG25 RG26 RG27 RG28 RG29 SO14 SO15 SO16 SO17 SO18 SO19 SO20 SO21 SO22 SO23 SO24 SO30 SO31 SO32 SO50 SO51 SO52 SO53 SP9 SP10 SP11
4 PO30 PO31 PO32 PO33 PO34 PO35 PO36 PO37 PO38 PO39 PO40 PO41
bobbingwide commented 1 year ago

Passmores and Regency have delivery charges depending on the band assigned to the delivery post code

bobbingwide commented 1 year ago

I've prototyped some JavaScript that demonstrates hiding and unhiding of HTML based on the delivery band determined from the postcode.

For the JavaScript to work.... The form is similar to before. It needs the id="postcode" attribute on the post code entry field and class="submit_pc" on the button for the JavaScript to work.

<form method="post">
    <input type="text" name="postcode" placeholder="Enter here..." maxlength="4" value="" id="postcode">
    <input type="submit" value="VIEW OPTIONS" class="submit_pc" >
</form>

The HTML for the different options is wrapped within a div with id="delivery_wrapper"

<div class="delivery delivery_band_not_set" id="delivery_wrapper">

<div class="delivery_band_not_set">Delivery band not set</div>
<div class="delivery_band_0">Delivery to elsewhere</div>
<div class="delivery_band_1">Delivery to band 1</div>
<div class="delivery_band_2">Delivery to band 2</div>
<div class="delivery_band_3">Delivery to band 3</div>
<div class="delivery_excluded">Delivery excluded</div>

<div class="removal delivery_band_1 delivery_band_2 delivery_band_3">Removal options - bands 1,2,3</div>

</div>

The CSS hides each nested div until the parent div has a class that matches one of the child div's classes.

<style>
    #delivery_wrapper div { display:none;}
    #delivery_wrapper.delivery_band_not_set .delivery_band_not_set { display: block; }
    #delivery_wrapper.delivery_band_0 .delivery_band_0 { display: block; }
    #delivery_wrapper.delivery_band_1 .delivery_band_1 { display: block; }
    #delivery_wrapper.delivery_band_2 .delivery_band_2 { display: block; }
    #delivery_wrapper.delivery_band_3 .delivery_band_3 { display: block; }
    #delivery_wrapper.delivery_band_4 .delivery_band_4 { display: block; }
    #delivery_wrapper.delivery_excluded .delivery_excluded { display: block; }
</style>

The JavaScript refers to some constants that will be enqueued by the server code.

<script type='text/javascript' id='vgccodes-js-extra'>
var vgccodes = {
    "postcodes": [['GU1'], ['GU2'], ['PO9'], ['PO30']],
    "excluded": ['AB10']
};
</script>

Attaches an event listener to the submit_pc input button. This calls setbands() to change the class name based on the post code entered. And it prevents the form from being submitted.

<script>
document.querySelector('input.submit_pc').addEventListener('click', function () {
    setbands();
    event.preventDefault();
});

The class name being set is returned in band. It defaults to delivery_band_not_set.

/**
 * Sets the delivery band code given the post code.
 *
 */
function setbands() {
    var postcode = document.getElementById('postcode').value;
    postcode = postcode.toUpperCase();
    postcode = postcode.trim();
    if ( postcode) {
        var band = get_delivery_band_code(postcode);
    } else {
        var band = 'delivery_band_not_set';
    }
    console.log( band);
    setClasses( band );
}

The get_delivery_band_code() looks up the post code in the exluded list first, then in the 4 different post code bands.

function get_delivery_band_code( postcode ) {
    var bandcode = 'delivery_excluded';
    if (vgccodes.excluded.includes(postcode))
        return bandcode;
    //let index = 0;
    bandcode = 'delivery_band_0';
    for ( let index = 0; index < vgccodes.postcodes.length; index++) {
        let bandcodes = vgccodes.postcodes[ index];
        console.log( bandcodes);
        if (bandcodes.includes(postcode)) {
            bandcode = 'delivery_band_' + (index + 1);
        }
    }
    return bandcode;
}

The new class is applied to the outer div with id delivery_wrapper

function setClasses( band ) {
    var delivery_wrapper = document.getElementById( 'delivery_wrapper');
    // Unset current classes
    // Add new band
    console.log( delivery_wrapper.classList);
    delivery_wrapper.classList.remove('delivery_band_not_set' );
    delivery_wrapper.classList.remove('delivery_band_0' );
    delivery_wrapper.classList.remove('delivery_band_1' );
    delivery_wrapper.classList.remove('delivery_band_2' );
    delivery_wrapper.classList.remove('delivery_band_3' );
    delivery_wrapper.classList.remove('delivery_band_4' );
    delivery_wrapper.classList.remove('delivery_excluded' );

    console.log( delivery_wrapper.classList);
    delivery_wrapper.classList.add( band );
    console.log( delivery_wrapper.classList);
    //delivery_wrapper.setAttribute( 'class', 'delivery_wrapper.classList);

}

</script>

The above prototyped logic needs to be converted into:

bobbingwide commented 1 year ago

My first pass attempt at implementing the solution uncovered a few glitches, leading me to pose these questions...

Regarding Delivery Options, I notice that the current logic requires the checkbox for Add Delivery to be checked. It's configured as addon-select-required

When this is set the current JavaScript logic automatically adds the Add Delivery item to the Current Cart.

Q: Where delivery charges are applicable, how important is it for customers to have to choose to have the product delivered?

Q: And should there be sanity check at checkout that the delivery option chosen matches their delivery address?

Q: Or even that the product is deliverable to their postcode?

bobbingwide commented 1 year ago

Section displayed when no post code has been entered. image

Free delivery for this brand to GU33 image

£60 delivery for Passmores to band 1. Note: Having added a Delivery cost of £222 to Passmores ( see https://github.com/bobbingwide/vgc/issues/59 ) then for any post code that's not listed in any band and when not excluded this is the price for Band 0

image

Postcode excluded image

bobbingwide commented 1 year ago

Q: Where delivery charges are applicable, how important is it for customers to have to choose to have the product delivered?

When an option has the class addon-select-required the current JavaScript automatically adds the first item in the list of options to the current cart item. This is performed on initial page load.
When the user has entered their post code the delivery price may change... but this is not reflected in the current cart item.

If it's mandatory that the customer has to choose the Delivery option then I'll need to add extra code to update the current cart when the post code's been entered. If not, then, we can switch the addon-select-required class off and then the user can choose to have the product delivered or not.

bobbingwide commented 1 year ago

Q: And should there be sanity check at checkout that the delivery option chosen matches their delivery address? Q: Or even that the product is deliverable to their postcode?

The current system allows products to be added to the cart both before and after post code validation.

bobbingwide commented 1 year ago

Q: I noticed that the Delivery Options section isn't toggleable. Other sections, including Building Removal, can be toggled. Should this be changed to be consistent?

Q: Should Building Removal be moved to below Delivery Options?

bobbingwide commented 1 year ago

Base options should be OK regardless of the customer's post code

This is not exactly true.

Q: Are bases available for post code band 4 or 0?

A: Values for https://gardenvista.co.uk/store/alton-cambridge-hb-9-x-8-ft-greenhouse/#options_area

Post code Band Concrete base Surcharge is
GU5 1 929.22 Not applied
GU1 2 969.22 40
GU6 3 999.22 70
PO30 4 929.22 Not applied
PL10 0 929.22 Not applied
bobbingwide commented 1 year ago

My question is now:

Question posed in an email....

Going forward, can base surcharges for bands 2 and 3 be removed?

Or are they still needed, and if so, what's the surcharge for bands 4 and 0 - elsewhere

bobbingwide commented 1 year ago

Q: Should Building Removal be moved to below Delivery Options?

In the latest incarnation I have move the postcode search into the options list so that it appears before Delivery Options and Building Removal.

In order to do this I had to remove the logic to display the single-product-sidebar-top dynamic widget area. I also removed the section that instructs the user to enter their post code

IMO these sections weren't all that necessary.

A full width version of the "we pride ourselves..." message appears after the options and Add to cart sidebar. plus a GO TO CHECKOUT button.

Instead of looking like this...

image

It now looks like this image

bobbingwide commented 1 year ago

The Postcode Search Text dynamic side bar is still available. image

bobbingwide commented 1 year ago

Currently, there's an intermittent problem with the display of the Building Removal section when the post code is changed and the band changes. This may be due to the height not being recalculated when the section that's hidden is changed.

bobbingwide commented 1 year ago

Revisting base options... I needed to change the addon-scripts.js to determine the visible add-on price, which is the price displayed based on the band for the selected postcode.

This is fine for the user who only enters their post code once. But after the post code has been changed, there's a problem with cart addition and removal for the Choose Your Base section.

Scenario

Product has a Concrete base price of 1200 for postcode band 1 (GU5) and 1240 for postcode band 2 (PO9).

  1. Product displayed. No postcode entered so Choose Your Base is displayed as Please enter the first part of your postcode (e.g. GU33) to check base options
  2. Enter postcode PO9 and View options
  3. For the Choose Your Base section the system selects No Base and adds it to the Current cart. £0
  4. Choose Concrete Base + £1240.00
  5. Item Current Cart item for base changes to Concrete base. Correct price.
  6. Enter postcode GU5 and View options
  7. Concrete base price now shows as + £1200.00
  8. But the Current cart still shows £1240.00
  9. Choose No base
  10. Cart totals incorrectly calculated. It's £40 too high
  11. Choose Concrete base.
  12. Cart totals adjusted but it's still too high.
  13. Choosing Add to cart resolves the problem in that the correct total is shown in the Cart.

There are two problems

bobbingwide commented 1 year ago

When the post code is changed the prices are not recalculated for currently selected items in the Current Cart.

In vgccodes.js the prices should be recalculated when the post code is changed.
Calling setupDefaultAddons() after setbands() doesn't resolve the problem.

But a function similar to it could be used to adjustPricesofSelectedOptions()

bobbingwide commented 1 year ago

I've developed the adjustPricesofSelectedOptions() JavaScript code to adjust the prices of the selected options after a post code change.

Scenario for post code change revisited

Product has a Concrete base price of 1200 for postcode band 1 (GU5) and 1240 for postcode band 2 (PO9).

  1. Product displayed. No postcode entered so Choose Your Base is displayed as Please enter the first part of your postcode (e.g. GU33) to check base options
  2. Enter postcode PO9 and View options
  3. For the Choose Your Base section the system selects No Base and adds it to the Current cart. £0
  4. Choose Concrete Base + £1240.00
  5. Item Current Cart item for base changes to Concrete base. Correct price.
  6. Enter postcode GU5 and View options
  7. Concrete base price now shows as + £1200.00
  8. Current cart updated accordingly. Cart Total correct.
  9. Choose No base
  10. Cart totals back to Starting at price.
  11. Choose Concrete base.
  12. Current cart and Cart Total correct.
  13. Choosing Add to cart produces correct results on the Cart page.
bobbingwide commented 1 year ago

Scenario for other options being chosen then post code changed

Same product as above. https://gvg.co.uk/store/a-test-product-2/

Continue above scenario where left off ( ie postcode GU5 ) with Concrete Base selected

  1. Note that under Delivery Options the Add Delivery checkbox is not preselected.
  2. It doesn't really matter in this example since the delivery is free.
  3. In Building Removal section choose removal of both a timber building and a greenhouse
  4. Both options added to the current cart.
  5. Blank out post code and View Options
  6. Cart emptied, except for FREE installation.
  7. Enter postcode GU5 again
  8. Concrete Base shown as selected, but not yet added.
  9. Click to add to current cart.
  10. In Building Removal the previously selected items are still highlighted
  11. But the items are not readded.
  12. In order to add them again you have to deselect the option, by selecting Please Choose, or any other item,
  13. Then reselect the original option.

Steps 8. and 11. to 13. are not as expected. But, there are at least workarounds which enable the user to get the desired results without having to reload the product.

bobbingwide commented 1 year ago

Continuing from step 13.

  1. Change postcode to DE10 ( for Delivery Excluded )
  2. Delivery Options becomes "Sorry we cannot supply..."
  3. Neither Choose Your Base nor Building Removal are available.
  4. Try PO9 then View Options
  5. Similar result as for step 8.
bobbingwide commented 1 year ago

Scenario with a product which is not a test product and that has many options. I chose https://gvg.co.uk/store/regency-valencia-summerhouse-7-x-5/ and had problems with the first option "Wood Types", which is a required addon, but doesn't display the price of 0.00 for Softwood.

image

The improved logic in getVisibleAddonPrice() didn't cater for the fact that the price is given a class of hidden in vgc_single_addon_prices().

Once that was fixed the problems that remained were:

bobbingwide commented 11 months ago

If you set it to 0 then delivery will be FREE for any postcode that's not in bands 1 to 4. I think this would be an odd thing to do.

Agreed. Delivery to band 0 is not supported when the price is not set but other delivery bands have a price. The message should be "Sorry we cannot supply this to your location"

See https://github.com/bobbingwide/vgc/issues/59#issuecomment-1610943514

bobbingwide commented 11 months ago

Agreed. Delivery to band 0 is not supported when the price is not set but other delivery bands have a price. The message should be "Sorry we cannot supply this to your location"

I checked in my local installation.

This logic doesn't need any further changes. But we do need to update the JavaScript to support options which have a class of addon-select-required.

bobbingwide commented 11 months ago

The add-to-cart action requires the following data to be passed to the server.

_REQUEST Array

    [single-single-addon-wood-types:softwood] => (string) "true"
    [multi-single-addon-window-options:add-double-side-opening-window] => (string) ""
    [multi-single-addon-verandah-option:monte-carlo-10-x-3-verandah-] => (string) ""
    [base_extra] => (string) "0"
    [building_removal_removal-and-taking-away-of-timber-building] => (string) ""
    [building_removal_removal-of-greenhouses] => (string) ""
    [installation] => (string) "no"
    [base-type] => (string) "no base"
    [b] => (string) "2"
    [delivery] => (string) "2"
    [awcdp_deposit_option] => (string) "no"
    [add-to-cart] => (string) "4877"

Currently the new JavaScript is setting the value for delivery to "on". This either needs to be changed to the correct value for the selected post code band in the JavaScript or the server code needs to cater for it.

bobbingwide commented 11 months ago

This either needs to be changed to the correct value for the selected post code band in the JavaScript or the server code needs to cater for it.

The correct value for the band is now set on the checkbox input field's value.

bobbingwide commented 11 months ago

If it's mandatory that the customer has to choose the Delivery option then I'll need to add extra code to update the current cart when the post code's been entered.

At our meeting on 20th Sept it was confirmed that the Delivery and Base options should treated as addon-select-required. I've been working on the JavaScript to implement this.

It all seems to be working fine until you click on the currently selected checkbox for Delivery Options or Choose Your Base after changing the post code to a different band.

bobbingwide commented 11 months ago

The add-to-cart action requires the following data to be passed to the server.

 [base-type] => (string) "no base"
 [b] => (string) "2"

For the Choose Your Base the value of the b field must be set correctly as well. Currently the value being passed for b is 0

bobbingwide commented 11 months ago

Currently the value being passed for b is 0

I changed the server code that calculates the base price so that it uses the value for delivery.

bobbingwide commented 11 months ago

It all seems to be working fine until you click on the currently selected checkbox for Delivery Options or Choose Your Base after changing the post code to a different band.

Rather than attempt to change the code when the user clicks on an already selected checkbox I added logic to disable the checkbox when it was selected and enable any checkbox that was not. I discovered that this prevented the field from being passed to the server when the user pressed the Add to cart button.

To resolve this issue I added an event listener on 'click'. When the Add to cart button is pressed it enables any checkbox that's checked, allowing the value to be passed to the server. This solution also necessitated the change in https://github.com/bobbingwide/vgc/issues/59#issuecomment-1737009500

It now makes sense to revisit the logic that should prevent use of the Add to cart button when the conditions for submission have not been satisfied.

  1. Post code should be set to a satisfiable value.
  2. Options for required addons should have been selected: both checkboxes and select fields
bobbingwide commented 11 months ago

There is already logic that attempts to disable the Add to cart button ( runRequiredAddonValidation) but I had to change it so that it only looks at the main set of optional addons, not the post code dependent ones.

I'm not sure how relevant this routine is now that I've prevented the option from being unchecked.

I'll try to add some logic to disable the Add to cart button when the the post code maps to delivery_band_not_set or delivery_excluded.

bobbingwide commented 11 months ago

When the post code maps to delivery_band_0 then sometimes delivery is supported and other times it's not.

bobbingwide commented 11 months ago

There is already logic that attempts to disable the Add to cart button

When writing the replacement logic to enable or disable the Add to cart button I discovered that if the button is disabled then setting the style to "cursor: not-allowed" and title to "Please enter a valid postcode" would appear to be a pointless exercise since the disabled status takes priority. I wonder if the original code ever did the right thing?

bobbingwide commented 11 months ago

When the post code maps to delivery_band_0 then sometimes delivery is supported and other times it's not.

In order to detect this we'll have to look for a delivery checkbox for the current delivery band code.

If there is one then that implies that the Add to cart button should be enabled. Otherwise, it should be disabled.

Note: When the delivery band is 0, but delivery is not supported because no Delivery cost has been set

See https://github.com/bobbingwide/vgc/issues/59#issuecomment-1611227392

bobbingwide commented 11 months ago

Scenario for post code change

Revisiting this scenario since the logic to ensure that a required addon checkbox is set now causes the Choose Your Base option to revert to No base(*).

https://gvg.co.uk/store/a-test-product-2/

Product has a Concrete base price of 1200 for postcode band 1 (GU5) and 1240 for postcode band 2 (PO9).

  1. Product displayed. No postcode entered so Choose Your Base is displayed as
  2. Please enter the first part of your postcode (e.g. GU33) to check base options`
  3. Enter postcode PO9 and View options
  4. Delivery is FREE.
  5. Add Delivery £0.00 added to the cart.
  6. Checkbox cannot be clicked.
  7. Add to cart button enabled.
  8. For the Choose Your Base section the system selects No Base and adds it to the Current cart. £0
  9. Choose Concrete Base + £1240.00
  10. Item Current Cart item for base changes to Concrete base. Correct price.
  11. Enter postcode GU5 and View options
  12. Base is reset to No base £0.00
  13. Current cart updated accordingly. Cart Total correct; back to Startiing at price.
  14. Choose Concrete base ( £1200 )
  15. Current cart and Cart Total correct.
  16. Choosing Add to cart produces correct results on the Cart page.

Same product as above. https://gvg.co.uk/store/a-test-product-2/ repeat steps up to 15.

  1. In Building Removal section choose removal of both a timber building and a greenhouse
  2. Both options added to the current cart.
  3. Blank out post code and View Options
  4. Cart emptied, except for FREE installation.
  5. Enter postcode GU5 again
  6. Choose Your Base option reverts to No base
  7. In Building Removal the previously selected items are still highlighted
  8. But the items are not readded.
  9. In order to add them again you have to deselect the option, by selecting Please Choose, or any other item,
  10. Then reselect the original option.

Steps 7. to 10. may not be as expected. But, there are at least workarounds which enable the user to get the desired results without having to reload the product.

(*) Does this mean that the code written to adjust the price - adjust PricesofSelectedOptions() - is now invalid?

bobbingwide commented 10 months ago

I changed the server code that calculates the base price so that it uses the value for delivery.

This also needed changing in calculate_price_on_cart_addition()

bobbingwide commented 10 months ago

v1.7.0 now installed on live and tested with:

https://gardenvista.co.uk/store/shedlands-heavy-duty-pent-shed-2-3/ https://gardenvista.co.uk/store/regency-security-apex-shed-4-x-4/ https://gardenvista.co.uk/store/alton-cambridge-hb-9-x-8-ft-greenhouse/

bobbingwide commented 10 months ago

Re https://github.com/bobbingwide/vgc/issues/59#issuecomment-1611227392

Base options should be OK regardless of the customer's post code Q: Are bases available for post code band 4 or 0?

A: With VGC v1.7.1 the base price ( with no surcharge ) is still shown for band 0. Delivery is FREE since the delivery cost is 0.

Note: this comment updated since retesting after applying the fix mentioned in https://github.com/bobbingwide/vgc/issues/59#issuecomment-1790381380

Values for https://gardenvista.co.uk/store/alton-cambridge-hb-9-x-8-ft-greenhouse

Post code Band Concrete base Surcharge is
GU5 1 929.22 Not applied
GU1 2 969.22 40
GU6 3 999.22 70
PO30 4 929.22 Not applied
PL10 0 929.22 Not applied
bobbingwide commented 10 months ago

I found a problem when testing https://gardenvista.co.uk/store/deponti-bosco-veranda-6060x3000mm/

There was a minor problem in the code. Fixed in 73395ec

bobbingwide commented 10 months ago

New version of brands.xlsx updated from Live

image

bobbingwide commented 10 months ago

Re: testing of delivery cost for a product in each brand

Brand # products Tested
Alton 62 https://gardenvista.co.uk/store/alton-cambridge-hb-9-x-8-ft-greenhouse/
BIC 0 n/a
Deponti 70 https://gardenvista.co.uk/store/deponti-bosco-veranda-6060x3000mm/
Eden Greenhouses 0 n/a
Elite Greenhouses 80 https://gardenvista.co.uk/store/elite-compact-4-x-4-ft-aluminium-greenhouse/
Gabriel Ash 0 n/a
Halls Greenhouses 64 https://gardenvista.co.uk/store/halls-wall-garden-lean-to-4-x-2-ft-green-greenhouse/
Janssens AluSystems 0 n/a
Juliana 0 n/a
Lidget Compton 0 n/a
Lugarde 22 https://gardenvista.co.uk/store/lugarde-garden-office-summerhouse-b15-13-x-11-ft/
Millboard 0 n/a
Milwood 4 https://gardenvista.co.uk/store/millwood-glass-garden-room/
Passmores 81 https://gardenvista.co.uk/store/passmores-log-store-3-x-6/
Regency 541 https://gardenvista.co.uk/store/regency-security-apex-shed-4-x-4/
Robinsons 164 https://gardenvista.co.uk/store/robinsons-ratcliffe-8-x-8-ft-greenhouse/
Shedlands 103 https://gardenvista.co.uk/store/shedlands-heavy-duty-pent-shed-2-3/
Swallow 134 https://gardenvista.co.uk/store/swallow-mallard-8-x-11-ft-painted-wooden-greenhouse/
The Grass Factory 0 n/a
Timber Garden Buildings 5 https://gardenvista.co.uk/store/the-coppice-collection-ashdown-apex-greenhouse-4-x-7-ft/
Vista Collection 8 https://gardenvista.co.uk/store/vista-apent-garden-room/
Vista Pergola 1 https://gardenvista.co.uk/store/vista-pergola-retractable/

Note: For Milwood, even though the delivery cost is not set delivery is FREE to all post code bands. For Passmores: Delivery is FREE for band 0. But for Regency we get Sorry we cannot supply...

This is inconsistent. ie wrong!

bobbingwide commented 10 months ago

For Passmores: Delivery is FREE for band 0. But for Regency we get Sorry we cannot supply... This is inconsistent. ie wrong!

This is due to the fact that when the Brand is first created, the delivery_cost field is not set if no value is entered. But when it has been set and then blanked out again the value stored is an empty string. This empty string needs to be treated as null.

bobbingwide commented 10 months ago

There was also a problem when the excluded postcodes were not set. When determining the post code band the JavaScript would fail when it encountered a null value for the excluded postcodes array. The fix is to correctly set this variable in the server side code to an empty array when applicable.

bobbingwide commented 10 months ago

The solution for VGC v1.7.2 delivery to post code band 0 can be summarised as below

Delivery Cost Delivery cost bands 1 to 4 Delivery to band 0
not set not set Not supported
0 not set FREE
nn not set nn to all bands, incl. 0
not set ww xx yy zz Not supported
vv ww xx yy zz vv