Skip to content

Instantly share code, notes, and snippets.

View wcraq_add_cart_item_data.php
<?php
/**
* Add cart item data.
*
* @param Array $cart_item_data Cart item meta data.
* @param Integer $product_id Product ID.
* @param Boolean $variation_id Variation ID.
*
* @return Array
*/
View oliver_get_bookings_for_tomorrow.php
<?php
/**
* Get all bookings scheduled for tomorrow
*/
function oliver_get_bookings_for_tomorrow() {
// Get tomorrow's date
$tomorrow = date( 'Y-m-j', strtotime('tomorrow') );
$args = array(
View number.css
/* Set number field to 100% width */
.pewc-style-simple .pewc-item input[type=number] {
width: 100% !important;
max-width: 100%;
}
View wcmmqo_add_to_cart_validation.php
<?php
/**
* Disable add to cart validation for min/max
*/
function prefix_remove_wcmmqo_add_to_cart_validation() {
remove_filter( 'woocommerce_add_to_cart_validation', 'wcmmqo_add_to_cart_validation', 10, 5 );
}
add_action( 'init', 'prefix_remove_wcmmqo_add_to_cart_validation');
@plugin-republic
plugin-republic / wcbvp-sticky-table-headers.css
Created Jan 13, 2023
Sticky headers for scrollable grid table in Better Variations
View wcbvp-sticky-table-headers.css
.wcbvp-scrollable {
height: 500px;
}
.woocommerce div.product form.cart table {
border-width: 0 0 1px;
position: relative;
}
.wcbvp-table-wrapper thead th {
position: sticky;
top: 0;
View ptuwc_field_price_html.php
<?php
/**
* Filter the product price in Product Table Ultimate
*/
function prefix_field_price_html( $price_html, $product, $args ) {
$price = $product->get_price(); // Just the numerical price, e.g. 4.50
$price_html = wc_price( $price ); // The price formatted with currency, e.g. $4.50
return $price_html;
}
add_filter( 'ptuwc_field_price_html', 'prefix_field_price_html', 10, 3 );
View prefix_custom_fonts.php
/**
* Hide duplicate metadata in order screen
*/
function prefix_custom_fonts() {
echo '<style>
table.display_meta {
display: none
}
</style>';
}
View wcmo_disable_new_registration_email.php
<?php
/**
* Disable new registration emails
*/
add_filter( 'wcmo_disable_new_registration_email', '__return_true' );
View wcbvp_enable_variations_grid.php
<?php
/**
* Role-based check for grid view
*/
function prefix_enable_grid_for_roles( $enable, $product_id ) {
$permitted_roles = array( 'administrator' );
if( is_user_logged_in() ) {
View prefix_update_time_field.php
<?php
/**
* JS function to dynamically remove options from an add-ons select field
* Update the field ID of your add-ons select field in line 12 below
*/
function prefix_update_time_field() {
?>
<script>
jQuery( document ).ready( function( $ ) {