Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
v:2.0:shipping:custom_code [2020/01/07 04:45] – [Free shipping based on a coupon] adam | v:2.0:shipping:custom_code [2020/05/28 16:09] – [Category Settings] marija | ||
---|---|---|---|
Line 7: | Line 7: | ||
<wrap tip> | <wrap tip> | ||
+ | ===== Category Settings ===== | ||
+ | You'll need to set each [[https:// | ||
===== Enabling Custom Shipping Code ===== | ===== Enabling Custom Shipping Code ===== | ||
Line 92: | Line 94: | ||
</ | </ | ||
+ | ==== Restricting shipping to only a specific set of postcodes ==== | ||
+ | This example can be used to prevent customers from being able to complete the checkout if they don't have a shipping address within a specific set of postcodes. The '' | ||
+ | |||
+ | <code javascript> | ||
+ | const allowed_postcodes = [55115, 55116]; | ||
+ | const postal_code = cart[' | ||
+ | |||
+ | if (allowed_postcodes.includes(postal_code)) { | ||
+ | rates.add(10001, | ||
+ | } else { | ||
+ | rates.error(' | ||
+ | } | ||
+ | </ | ||
==== Hiding specific shipping rates depending on the shipping state ==== | ==== Hiding specific shipping rates depending on the shipping state ==== | ||
Line 132: | Line 147: | ||
This example would allow free shipping if a coupon with a code of '' | This example would allow free shipping if a coupon with a code of '' | ||
+ | |||
+ | If you don't want to give a discount for the products and only free shipping, your coupon can be set to all the default settings with a '' | ||
<code javascript> | <code javascript> | ||
Line 236: | Line 253: | ||
If you're needing to get rates from other providers that Foxy doesn' | If you're needing to get rates from other providers that Foxy doesn' | ||
- | [[v: | + | [[v: |
+ | |||
+ | ==== Calculate flat rate shipping based on distance ==== | ||
+ | |||
+ | For stores that want to calculate a flat rate shipping cost based on the distance, rather than using a live rate provider like USPS, FedEx or UPS, this approach can use the Google Maps API to calculate the distance between the store address and the customers. | ||
+ | |||
+ | [[v: |