Skip to content

Instantly share code, notes, and snippets.

View bakura10's full-sized avatar

Michaël Gallego bakura10

View GitHub Profile
@bakura10
bakura10 / microdata-schema.liquid
Last active February 21, 2024 14:49
This is the last microdata-schema for our Shopify themes
{%- comment -%}
This snippet structures the micro-data using JSON-LD specification. Please note that for Product especially,
the schema often changes. We try to output as much info as possible, but Google may add new requirements over time,
or change the format of some info
LAST UPDATE: May 10th 2023 (we added the "hasMerchantReturnPolicy" and "shippingDetails" to include the shipping and
return policy if they have been specified as store policies).
{%- endcomment -%}
{%- if request.page_type == 'product' -%}
$variants = [];
foreach ($shopifyClient->getVariantsIterator(['fields' => 'id,inventory_quantity']) as $variant) {
$variants[$variant['id']] = $variant['inventory_quantity'];
}
foreach ($products as $index => $product) {
$delay = (int) ($index / 4);
if ($product['quantity'] === $variants[$product['id']] {
foreach ($products as $index => $product) {
$this->messageQueue->push(new DelayedMessage('product.validate_stock', [
'product' => $product['id']
], $index);
}
$this->messageQueue->flush();
@bakura10
bakura10 / instagram-patch.liquid
Created January 12, 2018 09:36
Update to fix the Instagram Section for Focal—premium Shopify theme
<script>
window.addEventListener("DOMContentLoaded",function(){var a=function(a){var e=new Date(1e3*a.created_time),t=e.getMonth(),n=e.getDate(),i=e.getFullYear(),r=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return a.created_time=r[t]+" "+n+", "+i,!0},e=function(e){var t={% raw %}'<div class="instagram-fix grid__cell 1/2 1/3--handheld-and-up 1/'+e.attr("data-images-per-row")+'--lap-and-up"><div class="instagram__image-wrapper" style="background-image: url({{image}})"><a href="{{link}}" target="_blank"><div class="instagram__overlay"><p class="instagram__caption">{{caption}}</p><time class="instagram__date">{{model.created_time}}</time></div></a></div></div>'{% endraw %};new Instafeed({get:"user",userId:"self",accessToken:e.attr("data-access-token"),sortBy:"most-recent",limit:e.attr("data-limit-images"),resolution:"standard_resolution",template:t,filter:$.proxy(a)}).run()};$(".index-module__instagram[data-access-token]").each(function(a,t){e($(t))})});
</script>
<style>
.ins
@bakura10
bakura10 / instagram-patch.liquid
Created January 12, 2018 09:52
Update to fix the Instagram Section for Kagami—premium Shopify theme
<script>
window.addEventListener("DOMContentLoaded",function(){var e=function(e,t){new Instafeed({get:"user",userId:"self",accessToken:e,sortBy:"most-recent",limit:t,resolution:"standard_resolution",template:{% raw %}'<div class="instagram__image-wrapper instagram-fix"><a href="{{link}}" style="background-image: url({{image}})" target="_blank"><div class="instagram__overlay"><p class="instagram__caption">{{caption}}</p><time class="instagram__date">{{model.created_time}}</time></div></a></div>'{% endraw %},after:function(){$("#instafeed-mobile").append($("#instafeed").html())},filter:$.proxy(function(e){var t=new Date(1e3*e.created_time);m=t.getMonth(),d=t.getDate(),y=t.getFullYear();var a=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return e.created_time=a[m]+" "+d+", "+y,!0})}).run()};!function(t){var a=t.attr("data-instagram-access-token"),n=t.attr("data-twitter-username");a&&e(a,n?3:6)}($(".index-module__social"))});
</script>
<style>
.instagram__image-wrapper > a {
p

DISCLAIMER: this is not really only about slate, just rough ideas on what I'd like to see in Shopify and that could be achieved in JS.

Hi everyone,

I had a talk with @t-kelly a few days ago and I'd like to expand on an idea that should represent what Slate could be in the future or what are the main frustration points in developing Shopify Themes.

Origin

We're now trying to develop more and more complex themes, both for the theme stores and clients. We're always trying to push the boundaries of what is possible with Shopify.

Pipeline events:
* add_product.pre
* add_product.post
Theme could add messages to the pipeline:
ShopifyApi.Pipeline.addProduct(1234, 1).then(function(pipelineStatus, cart) {
// do things
});
<?php
class SendSmsHandler
{
public function __invoke(SendSms $command)
{
if ($this->usageService->exceedsQuota($command->getShopDomain())) {
// Update
}
}
<?php
return array(
'service_manager' => array(
'aliases' => array(
'Zend\Authentication\AuthenticationService' => 'doctrine.authentication.orm_default'
)
)
);
$config = [
'router' => [
'routes' => [
'zfr-oauth2-server' => [
'chain_routes' => [
[
'type' => 'Hostname',
'options' => [
'route' => 'connect.saas-metrics.localhost'
]