Skip to content

Instantly share code, notes, and snippets.

View andreibabor's full-sized avatar

Andrei Babor andreibabor

View GitHub Profile
@andreibabor
andreibabor / BigCommerce Stencil: show first 3 products and then a new section using the last products
Created November 14, 2019 12:26
BigCommerce Stencil: show first 3 products and then a new section using the last products
<ul class="productGrid">
{{#each products }}
{{#if @index '<=' 2 }}
<li class="product">
{{>components/products/card show_compare=../show_compare show_rating=../settings.show_product_rating theme_settings=../theme_settings customer=../customer setting_show = ../settings}}
</li>
{{/if}}
{{/each}}
</ul>
@andreibabor
andreibabor / Shopify: Adding 2 products to cart with 1 add to cart button
Last active June 6, 2019 09:30
Shopify: Adding 2 products to cart with 1 add to cart button
https://community.shopify.com/c/Shopify-Apps/Can-you-add-multiple-products-to-cart-allow-linked-products/td-p/106753
https://community.shopify.com/c/Shopify-Design/Adding-2-products-to-cart-with-1-add-to-cart-button/m-p/272910
@andreibabor
andreibabor / Shopify: BespokeApp - other script using that app
Created May 25, 2019 06:08
Shopify: BespokeApp - other script using that app
/* This macro will be parsed as PHP code (see http://www.php.net)
The calculateshipping function is called every time a shipping calculation request is made by Shopify.
The function must return an array of available shipping options, otherwise no shipping options will be returned to your customers.
*/
function calculateshipping($DATA) {
/* do not edit above this line */
@andreibabor
andreibabor / Shopify - BespokeApp Shipping Script - different shipping rates for wholesale accounts
Created May 10, 2019 08:30
Shopify: BespokeApp Shipping Script - different shipping rates for wholesale accounts
/* This macro will be parsed as PHP code (see http://www.php.net)
The calculateshipping function is called every time a shipping calculation request is made by Shopify.
The function must return an array of available shipping options, otherwise no shipping options will be returned to your customers.
*/
function calculateshipping($DATA) {
/* do not edit above this line */
@andreibabor
andreibabor / Shopify: Metafield added on Variants
Last active May 8, 2019 08:54
Shopify: Metafield Variant
#div1{
.link{
display: none;
font-weight: 700;
color: #343434;
span{
color: #69f;
}
}
a[href^="#"]{
@andreibabor
andreibabor / Shopify: Wholesale + redirect on other page after submit
Last active September 7, 2022 20:43
Shopify: Wholesale + redirect on other page after submit
{% assign header_title = page.title %}
{% include 'page_header' with header_title %}
<div class="wrapper wrapper--margins wrapper__article">
<div class="rte">
<div class="text-center">
{{ page.content }}
</div>
@andreibabor
andreibabor / Shopify: Redirect Shopify customer to specific page after logout
Created February 22, 2019 17:41
Shopify: Redirect Shopify customer to specific page after logout
$(document).ready( function() {
$('a[href^="/account/logout"]').on("click", function() {
$.ajax( $(this).attr('href') )
.done(function() {
// Here you will change the url to whatever page you want to redirect to
window.location.href = "/pages/my-shopify-page";
});
return false;
});
});
@andreibabor
andreibabor / Javascript: create script type = 'text-javascript' using var
Created February 22, 2019 17:36
Javascript create text/javascript using var
<script>
$( document ).ready(function() {
//create a script element and set it's type and async attributes
var script = document.createElement('script'); script.type = 'text/javascript'; script.async = true;
//set the source of the script element
script.src = 'https://widgets.quadpay.com/stfrank/quadpay-widget-0.2.0.js?type=calculator&min=1&max=2500';
//add the script element to the DOM
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(script, s);
@andreibabor
andreibabor / Shopify: display Yotpo Reviews using API
Last active February 28, 2019 16:54
Shopify display Yotpo Reviews using API
var data = JSON.stringify(false);
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function () {
if (this.readyState === this.DONE) {
var test = this.responseText;
// Escaping Liquid in SCSS.
//
// Expected output:
// a{
// color: {{ settings.link-color }};
// }
a{
color: #{'{{ settings.link-color }}'};
}