This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
const discountValue = 'DISCOUNTCODEHERE'; | |
const daysToExpire = 7; | |
let discountCode; | |
if (document.cookie.includes("discount_code=")) { | |
discountCode = document.cookie.split('; ').find(row => row.startsWith('discount_code=')).split('=')[1]; | |
console.log("Discount code is: " + discountCode); | |
} else { | |
const date = new Date(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% assign image = image %} | |
<picture> | |
<source srcset="{{ image | img_url: '335x', format: 'pjpg'}}, {{ image | img_url: '670x', format: 'pjpg' }} 2x" | |
media="(max-width: 375px)"> | |
<source srcset="{{ image | img_url: '750x', format: 'pjpg'}}, {{ image | img_url: '1500x', format: 'pjpg' }} 2x" | |
media="(max-width: 749px)"> | |
<source srcset="{{ image | img_url: '1500x', format: 'pjpg' }}" | |
media="(min-width: 750px)"> | |
<img src="{{ image | img_url: '1500x', format: 'pjpg' }}" alt="" | |
srcset="{{ image | img_url: '1500x', format: 'pjpg' }}"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="product-template__container custom-call page-width" itemscope itemtype="http://schema.org/Product" id="ProductSection-{{ section.id }}" data-section-id="{{ section.id }}" data-section-type="product" data-enable-history-state="true"> | |
{% comment %} | |
Number of related items per row, | |
and number of rows. | |
{% endcomment %} | |
{% assign number_of_related_products_per_row = 4 %} | |
{% assign number_of_rows = 1 %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% if first_time_accessed %} | |
<script> | |
gtag('event', 'conversion', { | |
'send_to': ' ', | |
'value': {{ total_price | money_without_currency }}, | |
'currency': 'GBP', | |
'transaction_id': {{ order_number }}'' | |
}); | |
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<title> | |
{% if template == 'index' %} | |
{% if page_title contains 'Welcome' %} | |
{{ shop.name }} – Welcome | |
{% else %} | |
{{ page_title }} | |
{% endif %} | |
{% elsif template == '404' %} | |
Page Not Found | |
{% elsif page_title contains shop.name %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// This field method for Kirby adds a method called GBP (Since extended to gbpsmall or gbplarge) | |
// Use it like this | |
// echo $page->price()->gbplarge() | |
// This example is intended for large figures such as £100,000 or £5,000, there are no decimal places | |
field::$methods['gbplarge'] = function($field) { | |
return '£' . number_format($field->value, 0, '.' , ',' ); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* | |
* Wordpress and WooCommerce | |
* Add a "Cart" link to the menu when the cart is not empty | |
* | |
* When a customer adds an item to their woocommerce cart, a cart | |
* link will be added to the primary menu. | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Remove Cross-Sells from the shopping cart page | |
* | |
* Copy and paste this code into functions.php to | |
* remove cross-sells from the cart in WooCommerce. | |
* | |
* You may need to remove the opening <?php tag | |
* before you add it to your functions file. |