Skip to content

Instantly share code, notes, and snippets.

View moonbyt3's full-sized avatar
💭
out of the silent planet

Milorad Jekić moonbyt3

💭
out of the silent planet
  • Decem
  • Novi Sad
View GitHub Profile
@moonbyt3
moonbyt3 / wc_add_checkbox_to_checkout.php
Created December 16, 2023 17:41
Add checkbox to WooCommerce checkout process
<?php
// This snippet will add a checkbox that a user needs to check before checkout.
// Triggers if a certain product belongs to a 'restricted' categroy.
add_action( 'woocommerce_review_order_before_submit', 'add_terms_and_conditions_checkbox' );
function add_terms_and_conditions_checkbox() {
$terms = array(
'restricted' => '<strong>' . __("I confirm I'm X years old", 'text-domain') . '</strong>', //Set checkbox text here
);
@moonbyt3
moonbyt3 / functions.php
Last active November 3, 2020 13:15
Temporarily Disable WooCommerce Shop
// Trigger Closing Shop
add_action ('init', 'disable_woocommerce_shop');
// Disable Cart, Checkout, Add Cart
function disable_woocommerce_shop() {
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 );
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 );
remove_action( 'woocommerce_proceed_to_checkout', 'woocommerce_button_proceed_to_checkout', 20 );
remove_action( 'woocommerce_checkout_order_review', 'woocommerce_checkout_payment', 20 );
add_action( 'woocommerce_before_main_content', 'show_closed_shop_notice', 5 );
@moonbyt3
moonbyt3 / serbiaSVGmap.svg
Created February 16, 2020 01:13
SVG Map of Serbia
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
<?php
//for each category, show all posts
$cat_args=array(
'orderby' => 'name',
'order' => 'ASC'
);
$categories=get_categories($cat_args);
foreach($categories as $category) {
$args=array(
'showposts' => -1,
@moonbyt3
moonbyt3 / index.html
Created August 12, 2019 22:00
Todo List
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Page Title</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" media="screen" href="main.css">
<script src="main.js"></script>
</head>
@moonbyt3
moonbyt3 / flexible-responsive-background-image.markdown
Created August 9, 2019 09:03
Flexible Responsive Background Image
@moonbyt3
moonbyt3 / index.html
Created August 9, 2019 09:01
multi level dropdown jQuery
<div class="products-panel">
<div class="container products-panel-wrap">
<div class="products-sidebar">
<div class="products-sidebar-panel">
<span class="products-sidebar-title">Categories</span>
<div class="products-sidebar-list">
<a href="javascript:;" class="products-sidebar-category">P.O.S / Kiosks</a>
<a href="javascript:;" class="products-sidebar-category">Clamps and Mounts</a>
<a href="javascript:;" class="products-sidebar-category">PC Accessories</a>
</div>
@moonbyt3
moonbyt3 / index.html
Created August 9, 2019 08:39
Overflow hidden translated slides
<div class="slides">
<div class="slide slide--active" data-slide="1">
<h1>Slide 1</h1>
<span class="btn" data-slide-btn="2">Button 1</span>
<span class="btn" data-slide-btn="3">Button 2</span>
<span class="btn" data-slide-btn="4">Button 3</span>
</div>
<div class="slide" data-slide="2">
<h1>Slide 2</h1>
<span class="btn js-slide-return-btn">return</span>