Interoperability between Product Card Widget and Unified Shipping Module

A webshop embedding both the product card widget as well as the Unified Shipping Module can benefit from interoperation between the two widgets. The product card widget can store the postcode entered in a cookie. The Unified Shipping Module can use this cookie to save the user from having to enter the postcode again.

Demo

Shop Checkout

For the checkout, the postcode stored in the cookie on the product page is used as initial value for the postcode input field.

⇰ Back to product page

Configuration

Product card widget

The product card widget stores the entered postcode when the configuration option "allowStorage" is set to true. As this is the default value for this option, completely leaving out this option will also work.

Unified Shipping Module

The unified shipping module reads/writes the postal code (and other form values) from localStorage when the configuration option "allowStorage" is set to true. As this is the default value for this option, completely leaving out this option will also work.

<script>
  window.porterbuddy = {
    // other fields omitted
    language: 'NO',
    allowStorage: true,
  }
</script>