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

Product card

The product card widget is displayed on a product card to show if you can get the product with Porterbuddy. The postcode entered here is stored in and read from a cookie or localStorage for convenience for recurring visitors.

⇰ Go to checkout

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>