Skip to content

Instantly share code, notes, and snippets.

View bstonedev's full-sized avatar

Brett Stone bstonedev

View GitHub Profile
@bstonedev
bstonedev / WC->get_cart().php
Created February 11, 2020 00:17
$array = WC_Cart::get_cart();
Array(
[key] => b2518060b99e87b333629133e91ee828
[product_id] => 57317
[variation_id] => 0
[variation] => Array
(
)
[quantity] => 1
[data_hash] => b5c1d5ca8bae6d4896cf1807cdf763f0
[line_tax_data] => Array
@bstonedev
bstonedev / cheatsheet-ascii-unicode-quotation-marks.md
Created February 10, 2020 07:12
A Guide to ASCII, Unicode, UTF-8 and UTF-16 for quote marks and dashes.
UTF-16 UTF-8 DESCRIPTION SAMPLE
\U0022 \x22 QUOTATION MARK "
\U0027 \x27 APOSTROPHE '
\U201C \xe2\x80\x9c LEFT DOUBLE QUOTE
\U201D \xe2\x80\x9d RIGHT DOUBLE QUOTE
\U2018 \xe2\x80\x98 LEFT SINGLE QUOTE
\U2019 \xe2\x80\x99 RIGHT SINGLE QUOTE
\u002d \x2d A HYPHEN -
\u2013 \xe2\x80\x93 AN EN DASH
@bstonedev
bstonedev / ShopifyCheatsheet.md
Last active April 23, 2022 11:26
Shopify Liquid Cheatsheet

The Loops

-- product in all-products

{% for product in collections.all-products.products %}
   {{ product.title }}
   <ul>
       <li>{{ variant.image.src }} - Variant Image Object</li>
       <li>{{ variant.price }} - Variant Price</li>
@bstonedev
bstonedev / Listing Shopify Products by Tag
Created March 29, 2019 08:33
loop through all unique tags across your products, list products according to those unique tags.
Demo: https://stone-digital-test.myshopify.com/pages/tag-loop-example
<!-- Step 1) create comprehensive list of all tags ie. tags_list -->
{% capture tags_list %}
{% for product in collections.all-products.products %}
{% for tag in product.tags %}
{{ tag | strip | strip_newlines }}{% if forloop.last == true %}{% else %},{% endif %}
{% endfor %}{% if forloop.last == true %}{% else %},{% endif %}
{% endfor %}
{% endcapture %}