Skip to content

Instantly share code, notes, and snippets.

View tom-it's full-sized avatar

Thomas Lang tom-it

View GitHub Profile
{% assign restAmount = 2500 | minus : cart.total_price %}
{% if restAmount > 0 %}
Spend {{ restAmount | money}} more, and get free shipping!
{% endif %}
@tom-it
tom-it / beautified
Last active July 12, 2019 19:01
malware
'use strict';
var _0x151a = ["addressob", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", "_utf8_encode", "_keyStr", "_utf8_decode", "GetFromStorage", "bug-string-char-index", "json-parse", "json-stringify", "stringify", "function", "toJSON", "[1]", "null", '{"a":[1,true,false,null,"\\u0000\\b\\n\\f\\r\\t"]}', '"-271821-04-20T00:00:00.000Z"', '"+275760-09-13T00:00:00.000Z"', '"-000001-01-01T00:00:00.000Z"', "parse", "Object", "Number", "String", "SyntaxError", "TypeError", "JSON", "object",
"getUTCMonth", "getUTCDate", "getUTCHours", "getUTCMinutes", "getUTCSeconds", "getUTCMilliseconds", "json", "floor", "__proto__", "toString", "constructor", "prototype", "valueOf", "call", "[object Function]", "valueOf toString toLocaleString propertyIsEnumerable isPrototypeOf hasOwnProperty constructor", "split", "hasOwnProperty", "length", "000000", "slice", "charCodeAt", "\\u00", "[object Date]", "[object Number]", "[object String]", "[object Array]", "getUTCFullYear", "[object Boolean]", "push",
@tom-it
tom-it / shopify script
Created April 17, 2019 12:38
remove shipping option
puts('loop over all line_items, and check if one has weight over 50 lbs')
overWeight = false
Input.cart.line_items.each do |line_item|
if line_item.grams > 22679
overWeight = true
end
end
if overWeight
@tom-it
tom-it / checkout.js
Last active January 29, 2019 12:18
checkout.liquid add box to last step
<script>
(function ( $ ) {
$(document).ready(function(){
if(Shopify.Checkout.step == 'payment_method') {
$('.step__footer').before('<div style="margin-top:10px;background-color:#ccc;padding:10px;">Your custom message here</div>');
}
});
}(jQuery));
</script>
@tom-it
tom-it / Readme.md
Created December 11, 2018 22:24
Shopify Reorder Shipping rates

This shopify script is used on shopify+ Stores to reorder the shippingrates. (Great for using in combination with your custom shipping carrier service) (the first character of the shipping name should be a number (0..9)) then the script will reorder accordingly, and remove the first character

@tom-it
tom-it / catalog-model-shipping-zip_distance.php
Created October 22, 2018 21:15
opencart replace function
private function _googleUrl($params) {
return array(
'url' => 'https://maps.googleapis.com/maps/api/distancematrix/json',
'query' => 'origins=' . $params['origins'] . '&destinations=' . $params['destinations'] . '&mode=driving&units=' . $params['units'] . '&sensor=false&key=' . $this->config->get('zip_distance_api_key')
);
}
@tom-it
tom-it / duplicate.sh
Last active March 26, 2018 12:16
Opencart 3.0.2.0 duplicate default theme
#!/bin/bash
if [ "$#" -ne 3 ] || ! [ -d "$1" ]; then
echo "Usage: $0 THEMEDIR $1 ADMINDIR $2 COPYNAME" >&2
exit 1
fi
#The admin controller needs a capitalized theme name
function capitalize_first(){
string0=$COPY