Skip to content

Instantly share code, notes, and snippets.

View smeric's full-sized avatar

Sébastien Méric smeric

View GitHub Profile
@smeric
smeric / woocommerce_local_pickup_time_plugin_custom.php
Created November 10, 2020 22:20
This removes the title entirely to get rid of a duplicate sentence, resolving at the same time a <h2> problem...
<?php
/**
* Remove the WooCommerce Local Pickup Time plugin checkout page select field title.
*
* @see https://github.com/WC-Local-Pickup/woocommerce-local-pickup-time/issues/103
* @see https://github.com/WC-Local-Pickup/woocommerce-local-pickup-time/issues/104
*/
if ( class_exists( 'Local_Pickup_Time' ) ) {
// Remove the default local pickup time field from the checkout page.
remove_action( apply_filters( 'local_pickup_time_select_location', 'woocommerce_after_order_notes' ), array( Local_Pickup_Time::get_instance(), 'time_select') );
@smeric
smeric / woocommerce_local_pickup_time_plugin_custom_2.php
Last active July 8, 2021 08:18
This removes the title entirely to get rid of a duplicate sentence, resolving at the same time a <h2> problem... And offers a way to make the checkout choice of the date optionnal !
<?php
/**
* Remove the WooCommerce Local Pickup Time plugin checkout page select field title.
* And offers a way to make the checkout choice of the date optionnal !
*
* @see https://github.com/WC-Local-Pickup/woocommerce-local-pickup-time/issues/103
* @see https://github.com/WC-Local-Pickup/woocommerce-local-pickup-time/issues/104
*/
if ( class_exists( 'Local_Pickup_Time' ) ) {
// Add a checkbox field to make the pickup date choice optionnal
@smeric
smeric / woo_cart_has_virtual_product.php
Last active August 2, 2024 00:15 — forked from Katamo/gist:10243188
Check if the WooCommerce cart contains virtual product
<?php
/**
* Check if the cart contains virtual product
*
* @return bool
*/
function woo_cart_has_virtual_product(){
global $woocommerce;
// By default, no virtual product
<?php
// @link https://github.com/woocommerce/woocommerce/blob/master/includes/admin/wc-meta-box-functions.php#L141
$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