Skip to content

Instantly share code, notes, and snippets.

@lulessa
lulessa / wishl-langify-detect.liquid
Created September 1, 2016 00:20
Wishl wishlist Langify language switch implementation (for shops with more than one language)
{%- comment %}
Assign current language 2-letter code (e.g., en, fr, pt)
to language_code variable, then
use javascript to set Wishl app's language
{%- endcomment -%}
{%- assign language_code = shop.metafields.languages[language] -%}
{%- if shop.metafields.language_codes[language] -%}
{%- assign language_code = shop.metafields.language_codes[language] -%}
{%- endif -%}
<script type="text/javascript">
@lulessa
lulessa / wishl-transform-prices.js
Created September 1, 2016 00:08
Wishl (app for Shopify) javascript to modify prices on wishlist page
// Execute the function after wish list has completed loading.
$('#wishl-wrapper').on('listcomplete.wishl', function() {
// Change transformPrice function return value to suit your needs.
// Return value will directly replace item price on page.
// In this example, we add 25% to the price (multiply by 1.25)
// and move reformat it using Shopify's formatMoney function,
// which reflects the money format preferences of the current shop.
// If there is no price, or it is 0, transformPrice is not called.
/* Sample JavaScript file added with ScriptTag resource.
This sample file is meant to teach best practices.
Your app will load jQuery if it's not defined.
Your app will load jQuery if jQuery is defined but is too old, e.g. < 1.7.
Your app does not change the definition of $ or jQuery outside the app.
Example: if a Shopify theme uses jQuery 1.4.2, both of these statements run in the console will still return '1.4.2'
once the app is installed, even if the app uses jQuery 1.9.1:
jQuery.fn.jquery => "1.4.2"
$.fn.jquery -> "1.4.2"
*/