Skip to content

Instantly share code, notes, and snippets.

View espiat's full-sized avatar
🎯
Focusing

DER SPANIER espiat

🎯
Focusing
View GitHub Profile
@espiat
espiat / snippet69.php
Last active August 22, 2024 16:36
woocommerce only physical or virtual product in cart - with add on plugin "Product Bundles" (bundle is virtual but has physical products)
<?php
/**
* Validate cart items and prevent adding incompatible product types.
*
* @param bool $passed
* @param int $product_id
* @param int $quantity
* @return bool
*/
@espiat
espiat / german-market-mail-filter.php
Created January 17, 2024 10:50
German Market Marketpress - Mailing für B2B zb unterbinden per Filter
<?php
add_filter( 'gm_email_confirm_order_send_it', function( $boolean, $order ) {
if ( /*deine Anweisung */ ) {
$boolean = false;
}
return $boolean;
@espiat
espiat / gist:12b9b56b220bcffee15d9456b714b618
Created September 13, 2023 14:39
find-inline-javascript with console
var scripts = document.getElementsByTagName("script");
for (var i=0;i<scripts.length;i++) {
if (scripts[i].src) console.log(i,scripts[i].src)
else if (scripts[i].dataset.rocketSrc) console.log(scripts[i].dataset.rocketSrc)
else console.log(i,scripts[i].innerHTML)
}
@espiat
espiat / input.scss
Created December 10, 2022 13:58
Generated by SassMeister.com.
$brand__colors: (
primary: (
"h": 100,
"l": 50%,
"s": 15%,
"a": 0.9
),
secondary: (
"h": 100,
"l": 50%,
<?php
function remove_woo_commerce_hooks()
{
global $avada_woocommerce;
// remove cross sell section after item table in avada cart
// remove_action('woocommerce_cart_collaterals', array($avada_woocommerce, 'cart_collaterals'), 5); // coupon
remove_action('woocommerce_cart_collaterals', array($avada_woocommerce, 'cross_sell_display'), 5);
// add cross sell section after cart button
@espiat
espiat / acf-future-posts.php
Created March 10, 2022 10:59 — forked from aderaaij/acf-future-posts.php
Advanced Custom Fields datepicker: Show only events with a date of today or in the future. Extra comments from Pasnon @ ACF Forums: f you needed to, you could also play with the comparison date, which is the first array in meta_query, currently set to date("Y-m-d") which is today; if you were to make it date("Y-m-d", strtotime("-1 day")) you cou…
<?php
/*
* Display posts only from today and in the future:
* http://old.support.advancedcustomfields.com/discussion/6000/how-to-sort-posts-by-acf-date-and-display-only-future-posts
* by Pasnon
*/
$date_args = array(
'post_type' => 'events',
@espiat
espiat / add-submenu-page_to_custom_post_type_example.php
Created March 9, 2022 13:54 — forked from Njengah/add-submenu-page_to_custom_post_type_example.php
Simple function to add submenu page to a custom post type menu in WordPress admin
<?php
// Hook
add_action('admin_menu', 'add_tutorial_cpt_submenu_example');
//Callback function
function add_tutorial_cpt_submenu_example(){
@espiat
espiat / add_move_payment_request_checkout_page.php
Created December 20, 2021 21:25 — forked from dougaitken/add_move_payment_request_checkout_page.php
Adds the Payment Request button (Apple Pay) on the checkout page then moves it to after the customer details (WooCommerce Stripe extension)
// Adds the Payment Request button (Apple Pay) on the checkout page then moves it to after the customer details.
// Replace `woocommerce_checkout_after_customer_details` with wherever you want to
add_filter( 'wc_stripe_show_payment_request_on_checkout', '__return_true' );
remove_action( 'woocommerce_checkout_before_customer_details', array( WC_Stripe_Payment_Request::instance(), 'display_payment_request_button_html' ), 1 );
remove_action( 'woocommerce_checkout_before_customer_details', array( WC_Stripe_Payment_Request::instance(), 'display_payment_request_button_separator_html' ), 2 );
add_action( 'woocommerce_checkout_after_customer_details', array( WC_Stripe_Payment_Request::instance(), 'display_payment_request_button_html' ), 1 );
add_action( 'woocommerce_checkout_after_customer_details', array( WC_Stripe_Payment_Request::instance(), 'display_payment_request_button_separator_html' ), 2 );
@espiat
espiat / move_stripeprbutton.php
Created December 20, 2021 21:25 — forked from dougaitken/move_stripeprbutton.php
Moving the WooCommerce Stripe Payment Request buttons below the add to cart button
/** Move Stripe Payment Request Button on product page **/
remove_action( 'woocommerce_after_add_to_cart_quantity', array( WC_Stripe_Payment_Request::instance(), 'display_payment_request_button_html' ), 1 );
remove_action( 'woocommerce_after_add_to_cart_quantity', array( WC_Stripe_Payment_Request::instance(), 'display_payment_request_button_separator_html' ), 2 );
add_action( 'woocommerce_after_add_to_cart_button', array( WC_Stripe_Payment_Request::instance(), 'display_payment_request_button_html' ), 2 );
add_action( 'woocommerce_after_add_to_cart_button', array( WC_Stripe_Payment_Request::instance(), 'display_payment_request_button_separator_html' ), 1 );
<?php
$args = array(
'label' => '', // Text in Label
'class' => '',
'style' => '',
'wrapper_class' => '',
'value' => '', // if empty, retrieved from post meta where id is the meta_key
'id' => '', // required
'name' => '', //name will set from id if empty