Skip to content

Instantly share code, notes, and snippets.

@tasz
tasz / shopify product schema
Created August 28, 2020 19:13
Google Shema warning fix shopify product
{%- if request.page_type == 'product' -%}
{%- assign days_product_price_valid_until = 10 | times: 86400 -%}
{%- assign gtin_option = 'gtin' -%}
{%- if product.selected_or_first_available_variant.barcode != blank -%}
{%- assign is_barcode_available = true -%}
{%- assign gtin_string_length = product.selected_or_first_available_variant.barcode | size -%}
{%- if gtin_string_length == 8 or gtin_string_length == 12 or gtin_string_length == 13 or gtin_string_length == 14 -%}
{%- assign is_valid_gtin_length = true -%}
@tasz
tasz / gist:81e2da2109b048f58358fa9935715d55
Created March 28, 2020 06:38
Covid-19 woocommerce lockdown Shipping Delay message
add_action( 'woocommerce_checkout_after_terms_and_conditions', 'covid_19_checkout_code', 10 );
function covid_19_checkout_code( ) {
echo '<div class="woocommerce-danger"><p class="form-row validate-required">
<label class="woocommerce-form__label woocommerce-form__label-for-checkbox checkbox">
<input class="woocommerce-form__input woocommerce-form__input-checkbox input-checkbox" name="covid" id="covid" type="checkbox">
Covid 19 lock down: I am aware that my order only can be dispatched after lock down is over.
</label>
</p></div>
<?php
$filehashes = array(
'xmlrpc.php' => 'ec0319c65e8096c460fe78feee8b2288',
'wp-blog-header.php' => 'f3f43bcb755e7599abfd0cb56b710e81',
'readme.html' => '8734f564e795dad3f234b79f58e899d0',
'wp-signup.php' => 'b7deb3dbd61d082b99db157ae02a5280',
'index.php' => 'b9142a5f513a565bcb15430f4982000e',
'wp-cron.php' => '0f31e7fef84445fe4f4bf7c092ec6c10',
'wp-config-sample.php' => '3e42b983e0b6999d40027bada5f512e7',
'wp-login.php' => '0f216c7abc1bed25c99b17fa86a3da58',
<?php
global $post, $product;
$pricing_rule_sets = get_post_meta($post->ID, '_pricing_rules', true);
$pricing_rule_sets = array_shift($pricing_rule_sets);
if ($pricing_rule_sets && is_array($pricing_rule_sets) && sizeof($pricing_rule_sets) > 0){
?>