Skip to content

Instantly share code, notes, and snippets.

View danmeade's full-sized avatar

Dan Meade danmeade

View GitHub Profile
@bekarice
bekarice / wc-prevent-checkout-for-cart-with-specific-category.php
Last active June 29, 2023 20:32
Prevents checkout if the WooCommerce cart only contains items from a specific category
<?php // only copy this line if needed
/**
* Renders a notice and prevents checkout if the cart
* only contains products in a specific category
*/
function sv_wc_prevent_checkout_for_category() {
// set the slug of the category for which we disallow checkout
$category = 'clothing';
@JiveDig
JiveDig / is-current-users-post.php
Last active January 20, 2021 16:19
Helper function to check if the currently logged in user is the author of a specific post, by post ID
<?php
/**
* Helper function to check if a user is the author of a specific post
*
* @author Mike Hemberger
* @link http://thestizmedia.com/front-end-post-editing-with-caldera-forms/
* @param int $post_id Post ID
* @return bool
*/
@JiveDig
JiveDig / acf_front_end_edit.php
Last active July 24, 2024 18:03
ACF front end post editing
<?php
/**
* Check if user is logged in and is post author
* Setup functions for front end post editing
* @author Mike Hemberger
* @link http://thestizmedia.com/front-end-post-editing-with-acf-pro/
* @uses Advanced Custom Fields Pro
* @uses Sidr
*/
@webaware
webaware / add-to-cart.php
Last active October 9, 2024 00:33 — forked from mikejolley/functions.php
WooCommerce purchase page add-to-cart with quantity and AJAX, by customising the add-to-cart template in the WooCommerce loop. See blog post for details: http://snippets.webaware.com.au/snippets/woocommerce-add-to-cart-with-quantity-and-ajax/
<?php
/**
* Loop Add to Cart -- with quantity and AJAX
* requires associated JavaScript file qty-add-to-cart.js
*
* @link http://snippets.webaware.com.au/snippets/woocommerce-add-to-cart-with-quantity-and-ajax/
* @link https://gist.github.com/mikejolley/2793710/
*/
// add this file to folder "woocommerce/loop" inside theme